简体   繁体   English

VS 2017 .NET 4.6.2新的ASP.NET核心Web应用程序(.NET Framework)默认为x86平台

[英]VS 2017 .NET 4.6.2 new ASP.NET Core Web Application (.NET Framework) defaults to x86 platform

Why? 为什么?

Web Application (.NET Framework) and Core Web Application (.NET Core) both target AnyCPU platform. Web应用程序(.NET Framework)和Core Web应用程序(.NET Core)都是针对AnyCPU平台的。

Is this a bug or is there some value in doing this? 这是一个错误还是有一些价值吗?

I'm on Windows 10 x64 and have installed the 4/18/2017 VS 2017 update. 我在Windows 10 x64上安装了2017年4月18日VS 2017更新。

Microsoft Visual Studio Enterprise 2017 Version 15.1 (26403.7) Release VisualStudio.15.Release/15.1.0+26403.7 Microsoft .NET Framework Version 4.6.01586 Microsoft Visual Studio Enterprise 2017版本15.1(26403.7)发布VisualStudio.15.Release / 15.1.0 + 26403.7 Microsoft .NET Framework版本4.6.01586

I suppose it's for compatibility reasons. 我想这是出于兼容性原因。 The x86 is likely to refer to your <RuntimeIdentifier> in csproj. x86可能会引用<RuntimeIdentifier>中的<RuntimeIdentifier>

<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
  <RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup>

One of the reason it's required is for pulling Nuget dependencies and ASP.NET core relies on some native/non-managed libraries (=libraries not written in C#/CLR, but native ones in C/C++), like libuv (see NuGet ) which is an async socket library used by ASP.NET Core. 其中一个原因是需要拉动Nuget依赖项,ASP.NET核心依赖于一些本机/非托管库(=不是用C#/ CLR编写的库,而是用C / C ++编写的库),比如libuv(参见NuGet )这是ASP.NET Core使用的异步套接字库。

If it would default to x64 then this kind of applications couldn't be restored/run on x86 Operation Systems, so the only sane setting is x86 so far. 如果默认为x64则无法在x86操作系统上恢复/运行此类应用程序,因此到目前为止唯一合理的设置是x86。

For .NET CLR/IL Code, the architecture (x64 or x86) doesn't really matter, but for these external dependencies it does. 对于.NET CLR / IL代码,体系结构(x64或x86)并不重要,但对于这些外部依赖项,它确实如此。 That's also why you get errors when you covert project.json projects which did target net45 and netstandard1.x to csproj, you need to add the above xml code to your csproj, to give NuGet a hint which type of architecture it should restore. 这也是为什么当你将目标net45netstandard1.x为csproj的project.json项目转换时会出现错误的原因,你需要将上面的xml代码添加到你的csproj中,以便给NuGet一个提示它应该恢复哪种类型的体系结构。

You can safely change that to <RuntimeIdentifier>win7-x64</RuntimeIdentifier> , if you and none of your coworkers develop the project on an x86 OS. 您可以安全地将其更改为<RuntimeIdentifier>win7-x64</RuntimeIdentifier> ,如果您和您的同事都没有在x86 OS上开发项目。 For a list of valid RIDs (RuntimeIdentifiers), see the ASP.NET Core documentation . 有关有效RID(RuntimeIdentifiers)的列表,请参阅ASP.NET Core 文档 Though of course, for .NET Framework you are limited to the win* RIDs. 当然,对于.NET Framework,您仅限于win* RID。

It should be nothing to worry about and you can leave it at the default. 它应该没什么好担心的,你可以把它保留为默认值。 Usually it won't matter, as most libraries are are shipped with both x64 and x86 inside the NuGet package. 通常它没关系,因为大多数库都在NuGet包中附带x64和x86。 But there could be some libraries which only run on one or either. 但是可能有一些库只在一个或两个上运行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VS 2017 ASP.Net Core Web应用程序无法定位.Net Framework - VS 2017 ASP.Net Core Web Application cannot target .Net Framework 在ASP.NET Core中引用使用System.Web.HttpContext.Current的ASP.NET Framework 4.6.2 - Referencing ASP.NET framework 4.6.2 in ASP.NET Core, Which use System.Web.HttpContext.Current ASP.NET核心Web应用程序(.NET Framework)TagHelper Intellisense - ASP.NET Core Web Application (.NET Framework) TagHelper Intellisense VS2017 MSBuildWorkspace无法使用转换后的ASP.Net Core Web应用程序打开解决方案 - VS2017 MSBuildWorkspace fails opening solution with converted ASP.Net Core Web application 在visual studio 2015下以x86开始一个asp.net核心项目 - Start an asp.net core project as x86 under visual studio 2015 ASP.NET Web 应用程序(.NET 框架)中的 asp.net 核心 SignalR 配置 - asp.net core SignalR configuration in ASP.NET Web Application (.NET framework) 将CPU配置从AnyCPU更改为x86时,ASP.NET应用程序崩溃 - ASP.NET application crashes when CPU configuration is changed from AnyCPU to x86 Visual Studio社区2017-ASP.Net Web应用程序(.NET Framework)模板已损坏? - Visual Studio Community 2017 - ASP.Net Web Application (.NET Framework) Template broken? 我没有找到 ASP.NET 核心 Web 应用程序(新项目与代码) - I didn't found ASP.NET Core Web Application (New project vs code) Asp.NET 核心 web 应用程序在创建新项目时不显示 - Asp.NET Core web application not showing on creation of new project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM