COMPANY NEWS

Third-Party API and Package Map Support for .NET Upgrade Assistant

Updated July 1, 2024
Share:

.NET Upgrade Assistant

If you’ve ever needed to update your apps to a newer version of .NET, you’re probably familiar with the .NET Upgrade Assistant. This powerful tool from Microsoft makes the process of upgrading your project simple and straightforward - at least, it did for Microsoft libraries and frameworks. For external services, updating to a new version was still a manual and time-consuming process.

Well, not any more! .NET Upgrade Assistant just got a huge upgrade itself. Last month, Microsoft announced third-party API and package map support for its tool, allowing developers to share their own maps and making it easier for users to replace outdated third-party APIs and packages when updating to a new framework.

The addition of third-party API support provides a standardized approach to integrating APIs, while package mapping does what it says on the tin - it maps all of the packages used in your app, making it simpler to update the dependencies and improve the overall stability of your project.

Changing libraries has never been easier

Before this update, if your app relied on external services, upgrading to a newer version of .NET or changing framework was difficult. It meant manually finding equivalent APIs and packages - and that’s before you had to worry about updating all of the types and methods in your code. As Microsoft explains in its announcement post:

Let’s take Xamarin.Forms.Color for example. Not only do you need to update the namespace from Xamarin.Forms to Microsoft.Maui.Graphics, you also need to change properties like R, G or B to Red, Green or Blue, and the static Color properties like AliceBlue for example now belong to a new type called Colors.

Now that developers can create their own maps just like how Microsoft does with its owned libraries, these headaches are a thing of the past. And not just for updating libraries, the .NET Upgrade Assistant can now be used to change libraries all together.

Integrating Iron Software products into your application has always been simple, but switching over from another library to Iron Software wasn’t as straightforward. But now, with custom mapping and API support, it’s easier than ever to upgrade your app with a whole new library. Let’s take a look at this code to create a simple PDF in both IronPDF and PDFsharp:

IronPDF

using IronPdf;
var htmlToPdf = new HtmlToPdf();
var pdf = htmlToPdf.RenderHtmlAsPdf("<html><body><h1>Hello, IronPDF!</h1></body></html>");
pdf.SaveAs("ironpdf_example.pdf");
using IronPdf;
var htmlToPdf = new HtmlToPdf();
var pdf = htmlToPdf.RenderHtmlAsPdf("<html><body><h1>Hello, IronPDF!</h1></body></html>");
pdf.SaveAs("ironpdf_example.pdf");
Imports IronPdf
Private htmlToPdf = New HtmlToPdf()
Private pdf = htmlToPdf.RenderHtmlAsPdf("<html><body><h1>Hello, IronPDF!</h1></body></html>")
pdf.SaveAs("ironpdf_example.pdf")
VB   C#

PDFsharp

using PdfSharp.Pdf;
class Program
{
   static void Main()
   {
       // Create a new PDF document
       PdfDocument document = new PdfDocument();
       // Add a page to the document
       PdfPage page = document.AddPage();
       // Obtain a graphics object to draw on the page
       XGraphics gfx = XGraphics.FromPdfPage(page);
       // Draw "Hello, PDFsharp!" on the page
       gfx.DrawString("Hello, PDFsharp!", new XFont("Arial", 12), XBrushes.Black,
           new XRect(10, 10, page.Width, page.Height), XStringFormats.TopLeft);
       // Save the document to a file
       document.Save("output.pdf");
       // Close the document
       document.Close();
   }
}
using PdfSharp.Pdf;
class Program
{
   static void Main()
   {
       // Create a new PDF document
       PdfDocument document = new PdfDocument();
       // Add a page to the document
       PdfPage page = document.AddPage();
       // Obtain a graphics object to draw on the page
       XGraphics gfx = XGraphics.FromPdfPage(page);
       // Draw "Hello, PDFsharp!" on the page
       gfx.DrawString("Hello, PDFsharp!", new XFont("Arial", 12), XBrushes.Black,
           new XRect(10, 10, page.Width, page.Height), XStringFormats.TopLeft);
       // Save the document to a file
       document.Save("output.pdf");
       // Close the document
       document.Close();
   }
}
Imports PdfSharp.Pdf
Friend Class Program
   Shared Sub Main()
	   ' Create a new PDF document
	   Dim document As New PdfDocument()
	   ' Add a page to the document
	   Dim page As PdfPage = document.AddPage()
	   ' Obtain a graphics object to draw on the page
	   Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
	   ' Draw "Hello, PDFsharp!" on the page
	   gfx.DrawString("Hello, PDFsharp!", New XFont("Arial", 12), XBrushes.Black, New XRect(10, 10, page.Width, page.Height), XStringFormats.TopLeft)
	   ' Save the document to a file
	   document.Save("output.pdf")
	   ' Close the document
	   document.Close()
   End Sub
End Class
VB   C#

As you can see, switching libraries can involve lots of changes to your code, taking a lot of time, effort, and potentially making your application less stable. But now, we can semi-automate changes to namespaces, types, and methods, allowing you to upgrade your project with ease.

Iron Software and .NET go hand-in-hand

With this new update to the .NET Upgrade Assistant, it allows third-party developers to stay at the cutting edge of technology - able to keep their apps up to date alongside the latest releases of .NET Core and other frameworks. At Iron Software, compatibility has always been at the forefront of our products. With support for versions of .NET Core, Standard, and Framework going back years, we’ve always delivered industry-leading software no matter what setup our customers use. But now, you’re able to upgrade your app to newer versions without compromising stability or functionality - and we’ll be right there alongside you.

We're very excited about this update to .NET Upgrade Assistant. If you’re a developer interested in using this tool to update your Iron Software-supported apps, please get in touch so that we can help! And for everyone else, stay tuned for package maps that will improve your workflow and projects.

Iron Software products start for as little as $749 for a lifetime license (including a year’s free support, so we can help guide you through updating your app using these new tools). You can start with our 30-day free trial, and our software is also completely free to use for development purposes - so you can really get to see what it’s made of. For even bigger savings, check out the Iron Suite where you can get all nine Iron Software tools for the price of two. Happy coding!

NEXT >
Introducing IronWord: The C# DOCX Library for Word Doc editing