.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.
.NET已经变得越来越可移植。 不仅是.NET开放源代码的发展(阅读宣布.NET 2015-.NET为开放源代码,在Mac和Linux上为.NET,以及Visual Studio Community ),而且您当然知道Xamarin工具,以及,我希望, .NET Microframework等。
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.
您可以在整个.NET代码中运行,并且有一个工具可以使此操作更加容易。 尽管您几乎无法在任何平台上获得100%的可移植代码,但您可以通过智能重构进入神奇的90-95%,然后保持可插入平台的垫片。
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.
.NET可移植性分析器是一个免费的Visual Studio外接程序(或控制台应用程序),它将为您提供有关代码的可移植性的详细报告。 然后,您可以真正了解代码可以使用的范围,以及对Core CLR和备用平台的准备程度。
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.
例如,查看有关AutoFac的报告。 您可以看到,在大多数平台上,主装配体的形状都很奇妙。 可以理解,特定于平台的配置程序集的性能更差,但是仍然有完整的列表列出了哪些平台上提供了哪些方法以及明确的前进方向。
You'll get suggestions with a direction to head when you bump up against a missing or not-recommended API.
当您遇到缺少或不建议使用的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.
您可以分析特定的程序集或整个项目。 安装完成后,您将在“分析”菜单下找到命令,并且可以在“工具” |“工具” |“ .NET可移植性分析器”中更改选项。 选项菜单。
Even better, you can use this with the FREE Visual Studio Community that you can download at http://www.visualstudio.com/free.
更好的是,您可以将其与免费的Visual Studio社区一起使用,该社区可从http://www.visualstudio.com/free下载。
相关链接 (Related Links)
Cross-Platform Portable Class Libraries with .NET are Happening