[英]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. 这也是为什么当你将目标
net45
和netstandard1.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.