Thursday, May 15, 2014

How portable is your .NET code? API Portability Analyzer Alpha

Microsoft Downloads - API Portability Analyzer - Alpha

The API Portability Analyzer tool provides a list of .NET APIs used by an app, and portability of those .NET APIs on various .NET profiles/platforms.

Version: 1.0

Date Published: 5/12/2014

API Portability Analyzer Alpha Pre-Release License Terms.docx


The API Portability Analyzer tool provides list of .NET APIs used by an app, and portability of those .NET APIs on various .NET profiles/platforms. This allows easy portability analysis for developers who are considering porting existing app on various platforms.

Note: During the process of identifying the .NET APIs used by a binary Microsoft collects the list of .NET APIs used by the user submitted binaries. Microsoft also collects the names of various user created APIs. The tool does not collect the binary code, only names of APIs are collected. Microsoft will also collect assembly information such as assembly references for the binary & the Target Framework Moniker (TFM).


.NET Framework Blog


Targeting Multiple Platforms

We’ve been working for several years to make it easier to write code for multiple platforms, both as apps and libraries. We started by enabling our PCL reference assemblies for Xamarin, who quickly moved forward with that change. More recently, we’ve been working closely with Xamarin to make our .NET NuGet packages work better with Xamarin tools, to make it easier to build .NET apps for iOS and Android. There’s still work to do, but the experience has gotten much better and will continue to improve.

At TechEd, we announced a new portability analysis tool, called ApiPort. It provides you with two main pieces of data: the platforms that you can easily/reasonably target with your code, and the dependencies that are preventing you from targeting additional platforms.

The command line tool generates an Excel report that provides you with two views of its portability analysis. It provides a high-level color-coded view for a given set of platforms. It also provides a very detailed list of all the types and members used within your code, and whether they are supported, per platform. Given that the report is in Excel, it is very easy to filter the list, build pivot tables and do whatever else you want to perform further analysis.

The image below shows a small sample of the high-level portability analysis view. Only one assembly is shown, but there can be multiple. Check out this sample portability analysis to get a first-hand view.


The tool has another function, too. All of the dependency data (not the assemblies) are uploaded to an Azure service that the .NET team maintains. The data that the tool uploads is the list of assemblies and APIs that your code relies on. We do not record where the data came from or by whom. We do not upload any of your actual code or binaries. We want to know which functionality we need to bring to each platform to make it easier to target all platforms.

If you are finding it difficult to target a particular platform, please “vote” for the APIs you want added to a particular platform by running the tool on your app and libraries. It’s really easy to run the tool on a whole directory.

This first release of tool is missing a few features that we are in the process of adding. The Xamarin/Mono platforms are currently missing from the tool. It also doesn’t yet take into consideration NuGet packages that make .NET Framework APIs available on other platforms, counting them as missing APIs.


If you're wondering how portable your code is, this is one of your first stops...

No comments: