公司新聞

用於 .NET 升級助手的第三方 API 和套件映射支持

.NET升級助手

如果您曾經需要將您的應用升級到更新版本的.NET,您可能就熟悉.NET升級助手。 這個由Microsoft提供的強大工具使升級您的專案過程變得簡單明瞭——至少對於Microsoft的程式庫和框架來說是如此。 對於外部服務,升級到新版本仍然是一個手動且耗時的過程。

不過現在不再是這樣了! .NET升級助手本身也得到了巨大的升級。 上個月,Microsoft宣佈其工具支援第三方API和套件映射,允許開發人員分享自己的映射,使用戶在更新到新框架時更容易替換過時的第三方API和套件。

第三方API支援的增加提供了一種標準化的方法來整合API,而套件映射則對應應用中使用的所有套件,使更新依賴項和提高專案整體穩定性變得更簡單。

更換程式庫從未如此簡單

在此更新之前,如果您的應用依賴於外部服務,升級到更新版本的.NET或更改框架是困難的。 這意味著要手動尋找等效的API和套件——這還不包括要考慮更新代碼中所有類型和方法的問題。 正如Microsoft在宣佈帖子中解釋的那樣:

讓我們以Xamarin.Forms.Color為例。 您不僅需要將命名空間從Xamarin.Forms更新為Microsoft.Maui.Graphics,還需要將屬性如R、G或B改為Red、Green或Blue,並且靜態Color屬性如AliceBlue現在屬於一個稱為Colors的新類型。

現在開發人員可以像Microsoft對其程式庫所做的那樣創建自己的映射,這些麻煩已經成為過去。而且不僅僅是用於更新程式庫,.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")
$vbLabelText   $csharpLabel

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
$vbLabelText   $csharpLabel

正如您所見,切換程式庫可能涉及大量的代碼更改,這需要花費大量的時間和精力,並可能使您的應用變得不夠穩定。 但現在,我們可以半自動化對命名空間、類型和方法的更改,使您可以輕鬆升級專案。

Iron Software與.NET可謂天作之合

此.NET升級助手的新更新允許第三方開發人員處於技術最前沿——能夠讓他們的應用與.NET Core和其他框架的新版本一起保持同步更新。 在Iron Software中,兼容性一直是我們產品的首要考量。 支援.NET Core、Standard和Framework的版本已經很多年,我們一直無論客戶使用何種設定提供行業領先的軟體。 但現在,您可以在不影響穩定性或功能的情況下,把您的應用升級到較新的版本——我們也會一路伴您同行。

我們對此.NET升級助手的更新感到非常興奮。 如果您是開發者,有興趣使用此工具來更新您的Iron Software支援的應用,請與我們聯繫,以便我們提供協助!對於其他人,請繼續關注將改善您的工作流程和專案的套件映射。

Iron Software產品起價僅需$2,998即可獲得永久授權(包括一年的免費支援,讓我們可以幫助您通過這些新工具更新您的應用)。 您可以從我們的30天免費試用開始,我們的軟件也可完全免費用於開發用途——因此您可以真正了解到它的構成。 為了獲得更高的節省,請查看Iron Suite,您可以獲得所有九項Iron Software工具,只需支付兩項的價格。 祝開發愉快!