Events
17 Mar, 11 pm - 21 Mar, 11 pm
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Important
API Port has been deprecated in favor of binary analysis with the .NET Upgrade Assistant tool. The backend service of API Port has been shut down, so to use the tool, you must use it offline. For more information, see .NET API Port README.
Want to make your libraries support multi-platform? Want to see how much work is required to make your .NET Framework application run on .NET Core? The .NET Portability Analyzer is a tool that analyzes assemblies and provides a detailed report on .NET APIs that are missing for the applications or libraries to be portable on your specified targeted .NET platforms. The Portability Analyzer is a console app that analyzes assemblies by specified files or directory.
Once you've converted your project to target the new platform, like .NET Core, you can use the Roslyn-based Platform compatibility analyzer to identify APIs that throw PlatformNotSupportedException exceptions and other compatibility issues.
To begin using the .NET Portability Analyzer in Visual Studio, you first need to clone and build the dotnet-apiport project. It works on Visual Studio 2017 and Visual Studio 2019 versions.
Important
The .NET Portability Analyzer is not supported in Visual Studio 2022.
A useful step in analyzing a solution with many projects is to visualize the dependencies to understand which subset of assemblies depend on what. The general recommendation is to apply the results of the analysis in a bottom-up approach starting with the leaf nodes in a dependency graph.
To retrieve this, run the following command:
ApiPort.exe analyze -r DGML -f [directory or file]
A result of this would look like the following when opened in Visual Studio:
Enter the following command to analyze the current directory:
ApiPort.exe analyze -f .
To analyze a specific list of .dll files, enter the following command:
ApiPort.exe analyze -f first.dll -f second.dll -f third.dll
To target a specific version, use the -t
parameter:
ApiPort.exe analyze -t ".NET, Version=5.0" -f .
Run ApiPort.exe -?
to get more help.
It's recommended that you include all the related .exe and .dll files that you own and want to port, and exclude the files that your app depends on but you don't own and can't port. This will give you most relevant portability report.
Only APIs that are unsupported by a Target Platform appear in the report. Your .NET Portability report is saved as a file in the format you specified. The default is in an Excel file (.xlsx) in your current directory.
The Portability Summary section of the report shows the portability percentage for each assembly included in the run. In the previous example, 71.24% of the .NET Framework APIs used in the svcutil
app are available in .NET Core + Platform Extensions. If you run the .NET Portability Analyzer tool against multiple assemblies, each assembly should have a row in the Portability Summary report.
The Details section of the report lists the APIs missing from any of the selected Targeted Platforms.
You might find a Missing Assemblies section in your report. This section contains a list of assemblies that are referenced by your analyzed assemblies and were not analyzed. If it's an assembly that you own, include it in the API portability analyzer run so that you can get a detailed, API-level portability report for it. If it's a third-party library, check if there is a newer version that supports your target platform, and consider moving to the newer version. Eventually, the list should include all the third-party assemblies that your app depends on that have a version supporting your target platform.
For more information on the .NET Portability Analyzer, visit the GitHub documentation.
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
17 Mar, 11 pm - 21 Mar, 11 pm
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Modernize ASP.NET Framework to ASP.NET Core with the .NET Upgrade Assistant - Training
In this module, you'll learn to when, why, and how to modernize an ASP.NET Framework app to ASP.NET Core using the Upgrade Assistant.
Certification
Microsoft Certified: Power Platform Developer Associate - Certifications
Demonstrate how to simplify, automate, and transform business tasks and processes using Microsoft Power Platform Developer.
Documentation
Port from .NET Framework to .NET 7 - .NET Core
Understand the porting process and discover tools you might find helpful when porting a .NET Framework project to .NET 7.
Install .NET Upgrade Assistant - .NET Core
Learn how to install .NET Upgrade Assistant as a Visual Studio extension or a .NET Global Tool. .NET Upgrade Assistant assists you when upgrading projects to the latest dependencies or when upgrading to a new .NET
How to upgrade a project with .NET Upgrade Assistant - .NET Core
Learn how to upgrade one or more projects with .NET Upgrade Assistant using either Visual Studio or a terminal.