By Olia Gavrysh, Program Manager .NET team (email, Twitter)
Portability Analyzer helps porting applications between different .NET platforms (.NET Framework, .NET Core, .NET Standard, UWP, Xamarin) and versions. It analyzes your assemblies' references and identifies APIs that are not portable. The Portability Analyzer is offered as a Visual Studio Extension and as a stand-alone console app.
-
Install the extension.
a. Download and run Portability Analyzer installer from the Visual Studio Marketplace
b. You can also download it from Visual Studio. Open Visual Studio, in Tools > Extensions and Updates, search for ".NET Portability Analyzer", click Download. Then click Close and close Visual Studio.
-
Select your target platforms. In Visual Studio Analyze > Portability Analyzer Settings or right-click on your solution/project and click Portability Analyzer Settings.
- Run the analyzer. In Visual Studio open your application that you would like to analyze.
For this example let's download the sample source code, for which we use PowerCollections.
To analyze your entire project, right-click on your project in Solution Explorer and select Analyze Assembly Portability. To analyze only particular executable or DLL, go to the Analyze menu and select Analyze Assembly Portability. From there, select what you'd like to analyze.
- Study the results. To look at the .NET Portability Report click on Open Report in Portability Analysis Results window.
To navigate to the not supported APIs in your code, in Error List window double-click on the information massages.
-
Install the tool. Download and unzip Console Portability Analyzer
-
Select application to analyze. You can download the sample application we use here, which is Paint.NET.
-
Analyze application. From the command prompt run the following command to analyze the assemblies in the sample_binaries directory:
C:\Downloads\ApiPort\net461\win7-x64\ApiPort.exe analyze -f C:\Downloads\sample_binaries
To analyze a specific list of .dll
files, type the following command:
C:\Downloads\ApiPort\net461\win7-x64\ApiPort.exe analyze -f first.dll -f second.dll -f third.dll
You can find the portability report saved as an Excel file (.xlsx
) in your current directory.
- .NET Portability Analyzer Tools
- Documentation
- Why port to .NET Core
- Channel 9 video