Know your Code Better with .NET Portability Analyzer

Microsoft recently released a free Visual Studio console app named .NET Portability Analyzer. The tool gives you a detailed report on how portable your code is.

.NET Portability Analyzer

“Microsoft .NET Portability Analyzer gives you a real sense of how far you can take your code, as well as how prepared you’ll be for the Core CLR and alternate platforms,” said Scott Hanselman, Microsoft.

Scott examines the features of the tool with the help of Autofac report. If you examine the report, you will be able to view that the main assembly is in fantastic shape across most platforms. The tool displays a complete list of methods available on specific platforms.

.NET Portability Report

You will also view suggestions with a direction to head when you bump up against a missing or not-recommended API.

Dissecting .NET Portability Analyzer

.NET Portability Analyzer enables you to analyze specific assemblies or an entire project. You will find the commands under the Analyze menu. You can also modify options in theĀ  .NET Portability Analyzer options in the Tools | Options menu.

.NET Portability Analyzer can be used with the free Visual Studio Community edition.

Community Feedback

We are providing few feedback posted by developers on the Scott’s blog.

Matthew Blott

This is very useful. I’m guessing it can be run with legacy applications so you can see what you need to do to make your shared class libraries multi platform.

Mike C

Interesting timing on this blog post, right after Rocky Lhotka’s interview with .NET Rocks on Universal Apps where the take-away I got was that shared projects with #IFDEFs was the way to go for cross-platform projects, yielding a much cleaner codebase overall as opposed to a slim-functionality PCL with lots of adaptation/plumbing code per platform. With any luck the areas of .NET supported by the various platforms will increase to the point that PCLs will be a true write-once-run-anywhere answer to multi-platform, non-repetitive code reuse.

Alex Dresko

Maybe it’s just me, but I feel like the “platforms” being displayed in the report could use a little clarification. Telling me my code won’t run on Windows 8.1, when I’m very obviously running the code on Windows 8.1, is a little misleading unless you’re smart enough to realize it’s probably referring to Windows 8.1 apps.. The same goes for the other platforms listed… it’s not clear that, for example, ASP.NET vNext 1.0 probably (not sure) means the CoreCLR…

Leave a Comment