第三方 API 和包地图支持 .NET 升级助手
如果您曾经需要将应用程序更新到更新版本的 .NET,那么您可能对 .NET 升级助手很熟悉。 微软推出的这款强大工具使项目升级过程变得简单直接——至少对于微软的库和框架来说是如此。 对于外部服务而言,更新到新版本仍然是一个手动且耗时的过程。
但现在情况不同了! .NET升级助手本身也进行了重大升级。 上个月,微软宣布其工具支持第三方 API 和包映射,允许开发人员共享自己的映射,并使用户在更新到新框架时更容易替换过时的第三方 API 和包。
增加第三方 API 支持提供了一种标准化的 API 集成方法,而包映射正如其名——它映射应用程序中使用的所有包,从而简化了依赖项的更新,并提高了项目的整体稳定性。
更换库从未如此简单
在此次更新之前,如果您的应用依赖于外部服务,则升级到更新版本的 .NET 或更改框架会很困难。 这意味着要手动查找等效的 API 和包——而且这还没算上更新代码中的所有类型和方法。 正如微软在其公告中所述:
以 Xamarin.Forms.Color 为例。 您不仅需要将命名空间从 Xamarin.Forms 更新为 Microsoft.Maui.Graphics,还需要将 R、G 或 B 等属性更改为 Red、Green 或 Blue,并且静态 Color 属性(例如 AliceBlue)现在属于名为 Colors 的新类型。
现在,开发者可以像微软创建自有库一样创建自己的映射,这些麻烦事都已成为过去。而且,.NET 升级助手不仅可以用于更新库,现在还可以用于彻底更换库。
将 Iron Software 产品集成到您的应用程序中一直都很简单,但是从其他库切换到 Iron Software 却并非那么直接。 但现在,有了自定义映射和 API 支持,使用全新的库升级应用程序比以往任何时候都更加容易。 让我们来看一下这段代码,它分别在 IronPDF 和 PDFsharp 中创建了一个简单的 PDF 文件:
IronPDF。
// Import the required namespace from IronPDF
using IronPdf;
// Initialize the HtmlToPdf object
var htmlToPdf = new HtmlToPdf();
// Render the HTML content to PDF
var pdf = htmlToPdf.RenderHtmlAsPdf("<html><body><h1>Hello, IronPDF!</h1></body></html>");
// Save the generated PDF to a file
pdf.SaveAs("ironpdf_example.pdf");// Import the required namespace from IronPDF
using IronPdf;
// Initialize the HtmlToPdf object
var htmlToPdf = new HtmlToPdf();
// Render the HTML content to PDF
var pdf = htmlToPdf.RenderHtmlAsPdf("<html><body><h1>Hello, IronPDF!</h1></body></html>");
// Save the generated PDF to a file
pdf.SaveAs("ironpdf_example.pdf");' Import the required namespace from IronPDF
Imports IronPdf
' Initialize the HtmlToPdf object
Private htmlToPdf = New HtmlToPdf()
' Render the HTML content to PDF
Private pdf = htmlToPdf.RenderHtmlAsPdf("<html><body><h1>Hello, IronPDF!</h1></body></html>")
' Save the generated PDF to a file
pdf.SaveAs("ironpdf_example.pdf")PDFsharp
// Import the necessary namespaces from PDFsharp
using PdfSharp.Pdf;
// Define the main class that contains the program's entry point
class Program
{
// Main method: the entry point of the 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 to free resources
document.Close();
}
}// Import the necessary namespaces from PDFsharp
using PdfSharp.Pdf;
// Define the main class that contains the program's entry point
class Program
{
// Main method: the entry point of the 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 to free resources
document.Close();
}
}' Import the necessary namespaces from PDFsharp
Imports PdfSharp.Pdf
' Define the main class that contains the program's entry point
Friend Class Program
' Main method: the entry point of the 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 to free resources
document.Close()
End Sub
End Class如您所见,切换库可能会对您的代码进行大量更改,这会耗费大量时间、精力,并可能降低应用程序的稳定性。 但现在,我们可以半自动地更改命名空间、类型和方法,让您轻松升级项目。
Iron Software 和 .NET 是相辅相成的。
通过此次 .NET 升级助手的新更新,第三方开发人员可以始终处于技术前沿,使其应用程序能够与 .NET Core 和其他框架的最新版本保持同步更新。 在Iron Software,兼容性一直是我们产品设计的重中之重。 多年来,我们一直支持 .NET Core、Standard 和 Framework 的各种版本,无论客户使用何种配置,我们始终提供行业领先的软件。 但现在,您可以将应用程序升级到更新的版本,而不会影响稳定性或功能——我们将全程陪伴您。
我们对.NET升级助手此次更新感到非常兴奋。 如果您是开发者,并有兴趣使用此工具更新 Iron Software 支持的应用程序,请与我们联系,我们将竭诚为您提供帮助!对于其他用户,敬请期待即将推出的软件包映射,它们将有效提升您的工作流程和项目效率。
Iron Software 的产品起价仅为$1,999 ,即可获得终身许可证(包括一年的免费支持,因此我们可以帮助您使用这些新工具更新您的应用程序)。 您可以先体验我们的 30 天免费试用版,而且我们的软件也完全免费用于开发目的——这样您就能真正了解它的功能。 想要节省更多?那就来看看 Iron Suite 吧!只需支付两款工具的价格,即可获得 Iron Software 的全部九款工具。 祝您编码愉快!