Windows 通用应用程序 - Windows 10 没有 "Any CPU" 配置?

Windows Universal app - no "Any CPU" configuration for Windows 10?

我正在更新 Windows 使用

创建的通用项目

Windows Windows 10 技术 预览

的软件开发工具包 (SDK)

Windows Software Development Kit (SDK) for Windows 10 Insider Preview:

所以解决方案文件的变化只是 VisualStudioVersion14.0.22609.014.0.22823.1.

项目文件的改动也很小:

<TargetPlatformVersion>10.0.10030.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10030.0</TargetPlatformMinVersion>

 <TargetPlatformVersion>10.0.10069.0</TargetPlatformVersion>
 <TargetPlatformMinVersion>10.0.10069.0</TargetPlatformMinVersion>

问题是最初这个通用项目已针对 任何 CPU 配置成功构建,但现在我开始收到以下错误:

The processor architecture of the project being built "Any CPU" is not supported by the referenced SDK "Microsoft.NET.CoreRuntime, Version=1.0". Please consider changing the targeted processor architecture of your project (in Visual Studio this can be done through the Configuration Manager) to one of the architectures supported by the SDK: "x86, x64, ARM".

所以消息很清楚要做什么,只是想确认一下:

真的如此 Any CPU 不再可能用于从 "SDK for Windows 10 Insider Preview" 开始的通用项目吗?

更新

新创建的项目也没有AnyCPU - 默认是x86.

我假设您正在右键单击您的项目转到“属性”。在平台下 "Build" 的顶行,您有 ARM、x64、x86 和所有平台。在 "General" 组框中再往下一点,您有 "Platform target",它为您提供 Any CPU、x86、x64 和 ARM。

如果您正在查看配置管理器(build->Configuration Manager),那么您是正确的,只有 ARM、x64、x86、new... 和编辑...。如果您单击 New。 ..,"Any CPU" 是您可以添加的一个选项(默认),然后您可以返回并 select 它用于您的配置。

answer:

  1. Open your solution that contains your C# Windows Universal app. You will see that your project file (.csproj file) needs to be updated. Right-click the project file and choose to edit this file.

  2. Find the <PropertyGroup> element that contains the <TargetPlatformVersion> ... Next, set the value of the <Platform> element to x86 ...

  3. Find <PropertyGroup> elements that are configured for the AnyCPU platform as part of the Condition attribute. Remove these elements and all of their child elements. AnyCPU is not supported for Windows 10 apps in Visual Studio 2015 RC.

更新 1

从此视频 - Deep Dive into XAML and .NET Universal Windows App Development,转发到 0:32:28 - 似乎有(小)机会返回“任何 CPU" 在版本中:

更新 2

Visual Studio 2015 RC fixed bugs and known issues 再次确认:

The AnyCPU platform configuration is not supported for Windows 10 Insider Preview applications that are built by using C# and Visual Basic. This release of Visual Studio uses the .NET Native to build Windows 10 applications. The .NET Native compiles C# and Visual Basic code to native code and is not CPU-agnostic.

所以在我看来,即使对于 VS2015 RTM,恢复“AnyCPU”配置的希望也几乎消失了。

更新 3

嗯,the RTM is finally here and as expected - no AnyCPU:

Find elements that are configured for the AnyCPU platform as part of the Condition attribute. Remove these elements and all of their children. AnyCPU is not supported for Windows 10 apps in Visual Studio 2015.

好吧,AnyCPU 仍然存在 DLLWindows 运行时组件 项目类型。缺少 AnyCPU 是由于在发布配置中通用 Windows 应用程序默认使用 .NET Native。您可能知道,.NET Native 将应用程序及其所有依赖项链接到单个 EXE 中,因此 AnyCPU 仍会用于 DLL 和 WinRT 组件。

现在我不确定,但 DevDiv 人员似乎正在收集有关 .NET Native "default-ness" 的反馈,因此如果有足够的反馈,AnyCPU 到时或 RTM 之后仍可能 return对此。不过,我相信 .NET Native 是值得的,因为您通常还是通过应用商店部署您的应用程序。