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.
Related Links
- Leveraging existing code across .NET platforms
- Cross-Platform Portable Class Libraries with .NET are Happening
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Fortunately, Xamarin.Forms already has a community port for WinRT (and WPF), so you can build your application with one codebase and hit around 2.5B devices and workstations. That is something that no other managed code technology can claim to do, anywhere. Building a Xamarin.Forms application is like building a JavaScript application, but with organized namespaces (read: things make sense), superior performance, and most importantly... XAML! :)
What portable is in Environment.GetEnvironmentVariable("COMPUTERNAME") ?
I use netduino, netduino plus, and netduino plus 2 at this time.
also, other devices, such as various Arduino devices, with shields and associated MS Visual studio plug ins(i.e. Visual Micro). although these do not run on .net microframework does this plug in auto detect their presence?
Additionally, with the up and coming Internet of Things and how it may interact with the big data enterprise, what kind of add-in tools will MS come up with for realization of toolsets? IoT is going to be larger than the cellular industry, as it covers all industries. I hope that MS is prepared for this. Feedback?
Comments are closed.
But this and everything else that's happening is making it far easier to walk away from Windows - I really can't see a good business case for using Windows for greenfield projects. I find it hard to believe MS embracing OSS is down to altruism and I am genuinely confused by Microsoft's strategy. All welcome though :-)