第三方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 的全部九款工具。 祝您編碼愉快!