Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b8f2714
Update portability-analyzer.md
Lxiamail Jun 24, 2019
760dd1b
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
749f37f
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
da6874b
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
31ea4c5
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
5038812
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
f89af8e
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
cae80ec
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
cc8d817
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
075f52f
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
9633753
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
5f2678f
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
6f33d4e
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jun 25, 2019
18d0925
Improved the format of Details section
Lxiamail Jun 26, 2019
292478e
Update ApiPort console download link
Lxiamail Jun 28, 2019
45e0e23
Update portability report images
Lxiamail Jul 3, 2019
2afbe5c
Updated portability report image links
Lxiamail Jul 3, 2019
09ccf70
Update the common target section
Lxiamail Jul 3, 2019
e1b81cf
Some editing per Taylor's feedbacks
Lxiamail Jul 3, 2019
8f5f964
Updated Missing assemblies section
Lxiamail Jul 3, 2019
2d118a2
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jul 10, 2019
c1e8f6f
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jul 10, 2019
dc6b20e
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jul 10, 2019
c5bd970
filename should be lower case in doc. Remove the images with uppercas…
Lxiamail Jul 10, 2019
8900506
add back the images with corrected lower case names
Lxiamail Jul 10, 2019
0e3c9d8
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jul 10, 2019
473d6da
Update docs/standard/analyzers/portability-analyzer.md
Lxiamail Jul 10, 2019
f2e5f08
update image names with correct case and some wording per review feed…
Lxiamail Jul 10, 2019
95bc2fc
Update docs/standard/analyzers/portability-analyzer.md
Thraka Jul 10, 2019
82674c2
Fixed screenshot borders
Thraka Jul 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 51 additions & 18 deletions docs/standard/analyzers/portability-analyzer.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,74 @@
---
---
title: The .NET Portability Analyzer - .NET
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, UWP, and Xamarin.
ms.date: 04/26/2019
ms.date: 07/10/2019
ms.technology: dotnet-standard
ms.assetid: 0375250f-5704-4993-a6d5-e21c499cea1e
---
# The .NET Portability Analyzer

Want to make your libraries multi-platform? Want to see how much work is required to make your application compatible with other .NET implementations and profiles, including .NET Core, .NET Standard, UWP, and Xamarin for iOS, Android, and Mac? The [.NET Portability Analyzer](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer) is a tool that provides you with a detailed report on how flexible your program is across .NET implementations by analyzing assemblies. The Portability Analyzer is offered as a Visual Studio Extension and as a console app.
Want to make your libraries support multi-platform? Want to see how much work is required to make your application compatible with other .NET implementations and profiles, including .NET Core, .NET Standard, UWP, and Xamarin for iOS, Android, and Mac? The [.NET Portability Analyzer](https://github.com/microsoft/dotnet-apiport) is a tool that provides you with a detailed report on how flexible your program is across .NET implementations by analyzing assemblies. The Portability Analyzer is offered as a [Visual Studio Extension](https://marketplace.visualstudio.com/items?itemName=ConnieYau.NETPortabilityAnalyzer), which analyzes assembly per project, and as a [ApiPort console app](https://aka.ms/apiportdownload), which analyzes assemblies by specified files or directory.

## New targets
## Common targets

* [.NET Core](../../core/index.md): Has a modular design, employs side-by-side, and targets cross-platform scenarios. Side-by-side allows you to adopt new .NET Core versions without breaking other apps.
* [ASP.NET Core](/aspnet/core): is a modern web-framework built on .NET Core thus giving developers the same benefits.
* [Universal Windows Platform](/uwp): Improve performance of your Windows Store apps that run on x64 and ARM machines by using .NET Native’s static compilation.
* .NET Core + Platform Extensions: Includes the .NET Core APIs in addition to other APIs in the .NET ecosystem such as WCF, ASP.NET Core, FSharp, and Azure.
* .NET Standard + Platform Extensions: Includes the .NET Standard APIs in addition to other .NET ecosystem such as WCF, ASP.NET Core, FSharp, and Azure.
* [.NET Core](../../core/index.md): Has a modular design, employs side-by-side, and targets cross-platform scenarios. Side-by-side allows you to adopt new .NET Core versions without breaking other apps. If your goal is to port your app to .NET Core supporting cross-platforms, this is the recommended target.
* .[NET Standard](../../standard/net-standard.md): Includes the .NET Standard APIs available on all .NET implementations. If your goal is to make your library to run on all .NET supported platforms, this is recommended target.
* [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.
* .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.
* .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.

## How to use the Portability Analyzer
## How to use the .NET Portability Analyzer

To begin using the .NET Portability Analyzer, 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 later versions. You can configure it in Visual Studio via **Analyze** > **Portability Analyzer Settings** and select your Target Platforms.
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 later versions. You can configure it in Visual Studio via **Analyze** > **Portability Analyzer Settings** and select your Target Platforms, which is the .NET platforms/versions that you want to evaluate the portability gaps comparing with the platform/version that your current assembly is built with.

![Portability screenshot](./media/portability-analyzer/portability-screenshot.png)

To analyze your entire project, 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.
You can also use the ApiPort console application, download it from [ApiPort repository](http://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.

### Analyze portability
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.

![Portability Analyzer from Solution Explorer](./media/portability-analyzer/portability-solution-explorer.png)

After running the analysis, you'll see your .NET Portability Report. Only types that are unsupported by a target platform appear in the list and you can review recommendations in the **Messages** tab in the **Error List**. You can also jump to problem areas directly from the **Messages** tab.
You can also use the [ApiPort console app](https://aka.ms/apiportdownload).

* Type the following command to analyze the current directory: `ApiPort.exe analyze -f .`
* To analyze a specific list of .dll files, type the following command: `ApiPort.exe analyze -f first.dll -f second.dll -f third.dll`
* Run `ApiPort.exe -?` to get more help

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.

### View and interpret portability result

Only APIs that are unsupported by a Target Platform appear in the report.
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.

#### Portability Summary

![Portability Report](./media/portability-analyzer/portability-report.png)
![Portability Summary](./media/portability-analyzer/portabilitysummary.png)

If you don’t want to use Visual Studio, you can use the Portability Analyzer from the command prompt. Just download the API Portability Analyzer from the [Microsoft/dotnet-apiport](https://github.com/Microsoft/dotnet-apiport/releases) repository.
The Portability Summary section of the report shows the the portability percentage for each assembly included in the run. In the previous example, 89.74% of the .NET Framework APIs used in the `ConsoleAppFramework` app are available in .NET Core + Platform Extensions v2.2. If you run the .NET Portability Analyzer tool against multiple assemblies, each assembly should have a row in the Portability Summary report.

* Type the following command to analyze the current directory: `\...\ApiPort.exe analyze -f .`
* To analyze a specific list of .dll files, type the following command: `\...\ApiPort.exe analyze -f first.dll -f second.dll -f third.dll`
#### Details

Your .NET Portability Report is saved as an Excel file (*.xlsx*) in your current directory. The **Details** tab in the Excel Workbook contains more information.
![Portability Details](./media/portability-analyzer/portabilitydetails.png)

The Details section of the report lists the APIs missing from one of the Target Platforms.

- Target type: the type has missing API from a Target Platform
- Target member: the method is missing from a Target Platform
- Assembly name: the .NET Framework assembly that the missing
API lives in.
- 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.
- Recommended Changes: recommended API or technology to change to. Currently, this field is empty or out of date for a lot of APIs. Due to the large number of APIs, we have big challenge to keep it up. We are looking at alternate solutions to provide helpful information to customers.

#### Missing Assemblies

![Portability Details](./media/portability-analyzer/missingassemblies.png)

You may find a Missing Assemblies section in your report. It tells you that this list of assemblies 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 API level detailed portability report for it. If it's third party library, looks for if they have newer version supporting your target platform. If so, consider moving to the newer version. Eventually, you would expect this list includes all the third party assemblies that your app depends on and confirmed that they have a version supporting your target platform.

For more information on the .NET Portability Analyzer, visit the [GitHub documentation](https://github.com/Microsoft/dotnet-apiport#documentation) and [A Brief Look at the .NET Portability Analyzer](https://channel9.msdn.com/Blogs/Seth-Juarez/A-Brief-Look-at-the-NET-Portability-Analyzer) Channel 9 video.