.NET004-NET API Portability Tool


The goal of these tools is to help identify possible problem areas in an assembly and help direct targeted testing. You can click on the following link to view chinese instrucions to [api protability tool ]
The repository contains the source code for .NET Portability Analyzer tools and dependencies:https://github.com/Microsoft/dotnet-apiport
For example, you may analyze some dll, you can input [apiport analyze -f Microsoft.Exchange.AirSync.dll ]. Then you can get a report.
?

NET Core3.1 API Reference

  • .NET 6 RC 1 API Reference链接
  • There are two ways to install this tool, one is an extension in Visual Studio (this tool only supports Visual Studio 2017 and 2019 as of 2021.29, the latest 2022 RC version does not), and the other is the CMD tool (CLI version)
    https://github.com/Microsoft/dotnet-apiport/tree/dev/docs/VSExtension)Click How to obtain-Visual Studio extension gallery。
    https://github.com/Microsoft/dotnet-apiport)
    image.png
    If you input apiprot --helper, you can see the following context:
    image.png
    The console tool helps you determine how flexible your application is. The tool understands the following commands:

    Command Description Example
    analyze Analyzes the portability of an application Examples
    listTargets Lists .NET platforms available for analysis ApiPort.exe listTargets
    listOutputFormats Lists available report output formats ApiPort.exe listOutputFormats
    docId Searches for matching docIds ApiPort.exe docId
    dump Outputs the analysis request that will be sent to the service Example

    For examples, you can analyze a *.dll, you can get api analysis report.
    image.png
    image.png
    image.png
    Application Compatibility in the .NET Framework. For the list of breaking changes we analyze against, look here.
    Analyzing a directory and show any non-portable APIs
    ApiPort.exe analyze -f C:\git\Application\bin\Debug -p
    The -p flag will highlight any APIs that are not portable against the default target .NET platforms. (No explicit -t arguments were specified, so we use the default targets.)
    Analyzing a directory and show APIs that may cause PlatformNotSupportedException or NotImplementedException
    ApiPort.exe analyze -f C:\git\Application\bin\Debug -x
    The -x flag or --showExceptionApis will give a list of APIs currently being used that may throw on the target .NET Platforms. In JSON reports, this list will be labeled "ThrowingMembers" and contain information on which platforms throw which exceptions and group them together by DocID. In Excel reports, a tab labeled "Exceptions" will be added if there are exception throwing APIs found and will include information on assembly name, throwing API DocID, the exception thrown, and the corresponding target platforms that are thrown on. Currently this this argument is only supported with remotely generated JSON and Excel reports.
    https://github.com/Microsoft/dotnet-apiport

  • Compile using the build.cmd or build.sh script as normal
  • If in Visual Studio, set the project ApiPort.Offline as the startup project, or if from command line, go to bin[Configuration]\ApiPort.Offline\net46\win7-x64 and run ApiPort.exe from this directory.
  • There is a .NET Core build of the offline mode, but HTML reports will not be generated when running on .NET Core. Other than that, the functionality is expected to be the same.