You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn how to use the .NET Portability Analyzer tool to evaluate how portable your code is among the various .NET implementations, including .NET Core, .NET Standard, and UWP.
4
-
ms.date: 04/22/2022
5
-
ms.assetid: 0375250f-5704-4993-a6d5-e21c499cea1e
4
+
ms.date: 01/19/2025
6
5
---
7
6
8
7
# The .NET Portability Analyzer
9
8
10
9
[!INCLUDE[](~/includes/deprecating-api-port.md)]
11
10
12
-
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](https://github.com/microsoft/dotnet-apiport) 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 offered as a [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer), which analyzes one assembly per project, and as an [ApiPort console app](https://aka.ms/apiportdownload), which analyzes assemblies by specified files or directory.
11
+
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](https://github.com/microsoft/dotnet-apiport) 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](https://aka.ms/apiportdownload) that analyzes assemblies by specified files or directory.
13
12
14
13
Once you've converted your project to target the new platform, like .NET Core, you can use the Roslyn-based [Platform compatibility analyzer](platform-compat-analyzer.md) to identify APIs that throw <xref:System.PlatformNotSupportedException> exceptions and other compatibility issues.
15
14
16
15
## Common targets
17
16
18
-
-[.NET Core](../../core/introduction.md): Has a modular design, supports side-by-side installation, and targets cross-platform scenarios. Side-by-side installation allows you to adopt new .NET Core versions without breaking other apps. If your goal is to port your app to .NET Core and support multiple platforms, this is the recommended target.
19
-
-[.NET Standard](../net-standard.md): Includes the .NET Standard APIs available on all .NET implementations. If your goal is to make your library run on all .NET supported platforms, this is recommended target.
20
-
-[ASP.NET Core](/aspnet/core): A modern web-framework built on .NET Core. If your goal is to port your web app to .NET Core to support multiple platforms, this is the recommended target.
21
-
- .NET Core + [Platform Extensions](../../core/porting/windows-compat-pack.md): Includes the .NET Core APIs in addition to the Windows Compatibility Pack, which provides many of the .NET Framework available technologies. This is a recommended target for porting your app from .NET Framework to .NET Core on Windows.
22
-
- .NET Standard + [Platform Extensions](../../core/porting/windows-compat-pack.md): Includes the .NET Standard APIs in addition to the Windows Compatibility Pack, which provides many of the .NET Framework available technologies. This is a recommended target for porting your library from .NET Framework to .NET Core on Windows.
17
+
-[.NET](../../core/introduction.md): Has a modular design, supports side-by-side installation, and targets cross-platform scenarios. Side-by-side installation allows you to adopt new .NET versions without breaking other apps. If your goal is to port your app to .NET and support multiple platforms, this is the recommended target.
18
+
-[.NET Standard](../net-standard.md): Includes the .NET Standard APIs available on all .NET implementations.
19
+
-[ASP.NET Core](/aspnet/core): A modern web-framework built on .NET. If your goal is to port your web app to .NET (Core) to support multiple platforms, this is the recommended target.
20
+
- .NET + [Platform Extensions](../../core/porting/windows-compat-pack.md): Includes the .NET APIs in addition to the Windows Compatibility Pack, which provides many of the Windows-specific .NET Framework technologies.
21
+
- .NET Standard + [Platform Extensions](../../core/porting/windows-compat-pack.md): Includes the .NET Standard APIs in addition to the Windows Compatibility Pack, which provides many of the Windows-specific .NET Framework technologies.
23
22
24
23
## How to use the .NET Portability Analyzer
25
24
26
-
To begin using the .NET Portability Analyzer in Visual Studio, you first need to download and install the extension from the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer). It works on Visual Studio 2017 and Visual Studio 2019 versions.
25
+
To begin using the .NET Portability Analyzer in Visual Studio, you first need to [clone and build the dotnet-apiport project](https://github.com/microsoft/dotnet-apiport/blob/dev/docs/Console/README.md#run-the-tool-in-an-offline-mode). It works on Visual Studio 2017 and Visual Studio 2019 versions.
27
26
28
27
> [!IMPORTANT]
29
28
> The .NET Portability Analyzer is not supported in Visual Studio 2022.
30
29
31
-
Configure it in Visual Studio via **Analyze** > **Portability Analyzer Settings** and select your Target Platforms, which are the .NET platforms/versions that you want to evaluate the portability gaps comparing with the platform/version that your current assembly is built with.
30
+
### Solution-wide view
32
31
33
-

32
+
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.
34
33
35
-
You can also use the ApiPort console application, download it from [ApiPort repository](https://aka.ms/apiportdownload). You can use `listTargets` command option to display the available target list, then pick target platforms by specifying `-t` or `--target` command option.
36
-
37
-
### Solution wide view
38
-
39
-
A useful step in analyzing a solution with many projects would be 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.
40
-
41
-
To retrieve this, you may run the following command:
34
+
To retrieve this, run the following command:
42
35
43
36
```console
44
37
ApiPort.exe analyze -r DGML -f [directory or file]
@@ -50,19 +43,13 @@ A result of this would look like the following when opened in Visual Studio:
50
43
51
44
### Analyze portability
52
45
53
-
To analyze your entire project in Visual Studio, right-click on your project in **Solution Explorer** and select **Analyze Assembly Portability**. Otherwise, go to the **Analyze** menu and select **Analyze Assembly Portability**. From there, select your project's executable or DLL.
54
-
55
-

56
-
57
-
You can also use the [ApiPort console app](https://aka.ms/apiportdownload).
58
-
59
-
Type the following command to analyze the current directory:
46
+
Enter the following command to analyze the current directory:
60
47
61
48
```console
62
49
ApiPort.exe analyze -f .
63
50
```
64
51
65
-
To analyze a specific list of .dll files, type the following command:
52
+
To analyze a specific list of *.dll* files, enter the following command:
It is 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.
66
+
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.
80
67
81
68
### View and interpret portability result
82
69
83
-
Only APIs that are unsupported by a Target Platform appear in the report.
84
-
After running the analysis in Visual Studio, you'll see your .NET Portability report file link pops up. If you used the [ApiPort console app](https://aka.ms/apiportdownload), 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.
70
+
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.
85
71
86
72
#### Portability Summary
87
73
@@ -95,18 +81,18 @@ The Portability Summary section of the report shows the portability percentage f
95
81
96
82
The **Details** section of the report lists the APIs missing from any of the selected **Targeted Platforms**.
97
83
98
-
- Target type: the type has missing API from a Target Platform
99
-
- Target member: the method is missing from a Target Platform
100
-
- Assembly name: the .NET Framework assembly that the missing
101
-
API lives in.
102
-
- Each of the selected Target Platforms is one column, such as ".NET Core": "Not supported" value means the API is not
103
-
supported on this Target Platform.
104
-
- Recommended Changes: the recommended API or technology to change to. Currently, this field is empty or out of date for many APIs. Due to the large number of APIs, we have a significant challenge to keep it up to date. We're looking at alternative solutions to provide helpful information to customers.
84
+
- Target type: the type has missing API from a Target Platform.
85
+
- Target member: the method is missing from a Target Platform.
86
+
- Assembly name: the .NET Framework assembly that the missing API lives in.
87
+
- Each of the selected Target Platforms is one column, such as ".NET Core": "Not supported" value means the API is not supported on this Target Platform.
88
+
- Recommended Changes: the recommended API or technology to change to. Currently, this field is empty or out of date for many APIs. Due to the large number of APIs, it's a significant challenge to keep it up to date.
105
89
106
-
#### Missing Assemblies
90
+
#### Missing assemblies
107
91
108
92

109
93
110
-
You may 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.
94
+
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.
95
+
96
+
## See also
111
97
112
98
For more information on the .NET Portability Analyzer, visit the [GitHub documentation](https://github.com/Microsoft/dotnet-apiport#documentation).
> API Port has been deprecated in favor of binary analysis with the [.NET Upgrade Assistant](../docs/core/porting/upgrade-assistant-overview.md) 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](https://github.com/microsoft/dotnet-apiport/blob/dev/docs/Console/README.md#run-the-tool-in-an-offline-mode).
0 commit comments