How to configure .net native in Visual Studio 2015?

旧时模样 提交于 2020-01-01 08:03:25

问题


I read this guide for .net native, but I can't found 'Enable for .net native' in popup menu. Should I install some extra plugin for VS2015 for compile with .net native?


回答1:


[

This is the Project + Properties, Build tab of a project that was created with one of the Project > New > Visual C# > Windows > Universal project templates. Your machine must boot Windows 10, you may need to download the SDK separately if you installed VS2015 before Win10. Red arrows indicate the important parts, it should only be enabled for the Release configuration. The Platform setting matters as well, you need to test this for all platforms you wish to support (ARM, x86, x64).

Emphasis on the word test. The only reason you have the .NET Native toolchain on your machine is to verify that your app still operates correctly after the Store server recompiles the package you submitted. It is rather imperfect and cannot handle every possible Universal app. Several pain points, the major one is Reflection. The toolchain cannot see any types you load with reflection so cannot know that these types need to be converted to native code as well. Your app will fail miserably on the user's machine if this isn't taken care of.

Testing is simply a matter of running the Release build of your program through its paces, verifying that everything still works correctly. Start with the x86 platform first. You can cut a few corners when you next test x64 and ARM.

The package you actually submit to the Store is the one that is not built with .NET Native. Microsoft wants to keep the option open to improve the toolchain so needs the MSIL version of your assemblies. Version numbering matters, the last digit is reserved for the store. They'll increment it when they rebuild your app.

In case it wasn't clear yet: the .NET Native toolchain is only available for Universal apps that are distributed through the Store. Maybe it will be usable some day on regular apps but that day is far off, a fundamental different way to package such apps will have to come first.




回答2:


.NET Native only works for Windows Store apps currently, you must make sure you chose a windows store app when you created the project for the option to be available.

From the .NET Native FAQ

Will Server/Desktop apps benefit from .NET Native and/or the Compiler in the Cloud?
Desktop apps are a very important part of our strategy. Initially, we are focusing on Windows Store apps with .NET Native. In the longer term we will continue to improve native compilation for all .NET applications.




回答3:


To install the Windows 10 SDK which includes the .NET debugging tools.

Go here and download the SDK.

https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

Open the MSI and Pick your tool sets.



来源:https://stackoverflow.com/questions/31981569/how-to-configure-net-native-in-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!