Getting ready for the future with the Microsoft .NET Portability Analyzer
.NET has been getting more and more portable. Not only is .NET Open Source going forward (read Announcing .NET 2015 - .NET as Open Source, .NET on Mac and Linux, and Visual Studio Community) but you of course know about Xamarin tools, as well as, I hope, the .NET Microframework, and much more.
You can run your .NET code all over, and there's a tool to make this even easier. While you'll rarely get 100% portable code with any platform, you can get into the magic 90-95% with smart refactoring, then keep the platform-specific shims pluggable.
The .NET Portability Analyzer is a free Visual Studio Add-in (or console app) that will give you a detailed report on how portable your code is. Then you can get 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.
Take a look at this report on AutoFac, for example. You can see that the main assembly is in fantastic shape across most platforms. Understandably the more platform-specific Configuration assembly fares worse, but still there's a complete list of what methods are available on what platforms, and a clear way forward.
You'll get suggestions with a direction to head when you bump up against a missing or not-recommended API.
You can analyze specific assemblies, or an entire project. Once installed, you'll find the commands under the Analyze menu, and you can change options in the .NET Portability Analyzer options in the Tools | Options menu.
Even better, you can use this with the FREE Visual Studio Community that you can download at http://www.visualstudio.com/free.
- Leveraging existing code across .NET platforms
- Cross-Platform Portable Class Libraries with .NET are Happening