如何在Visual Studio 2015中配置.net本机? [英] How to configure .net native in Visual Studio 2015?

查看:131
本文介绍了如何在Visual Studio 2015中配置.net本机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了指南.net本机,但在弹出菜单中找不到为.net本机启用".我是否应该为VS2015安装一些额外的插件以与.net本机一起编译?

解决方案

[

这是使用项目">新建">"Visual C#">"Windows">通用"项目模板之一创建的项目的项目+属性"的构建"选项卡.您的计算机必须启动Windows 10,如果在Win10之前安装了VS2015,则可能需要单独下载SDK.红色箭头指示重要部分,仅应为发布"配置启用它.平台设置也很重要,您需要针对希望支持的所有平台(ARM,x86,x64)进行测试.

强调单词test.您的计算机上装有.NET Native工具链的唯一原因是,在商店服务器重新编译提交的包之后,请验证您的应用程序仍然可以正常运行.它不是很完美,无法处理所有可能的通用应用程序.几个痛点,主要是反思.工具链无法看到您通过反射加载的任何类型,因此无法知道这些类型也需要转换为本机代码.如果不及时处理,您的应用将在用户的计算机上严重失败.

测试仅是通过逐步运行程序的Release版本来进行的,只需验证一切仍可正常运行即可.首先从x86平台开始.下次测试x64和ARM时,您可以开一些捷径.

您实际提交给商店的软件包是不是.em Native构建的软件包. Microsoft希望保持打开状态以改进工具链,因此需要您的程序集的MSIL版本.版本编号很重要,最后一位保留给商店.他们在重建您的应用程序时会增加它.

如果还不清楚:.NET本机工具链仅适用于通过商店分发的通用应用程序.也许有一天有一天可以在常规应用程序上使用,但是那一天还很遥远,因此打包这些应用程序的根本不同方法必须首先解决.

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?

解决方案

[

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.

这篇关于如何在Visual Studio 2015中配置.net本机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆