如何在Visual Studio 2015中更改ASP.NET Core构建平台

4
在VS 2015中,是否可以将ASP.NET Core项目的构建平台从Any CPU更改为x64?每次尝试通过配置管理器进行编辑时,它都会恢复到Any CPU。即使编辑解决方案文件(.sln)也无效,因为VS在下次重新加载项目/解决方案时会默默地重置它...这似乎是与此处报告的问题相同。我之所以问是因为它“卡”在Any CPU上,这在构建项目时会引用其他仅配置为x64平台的项目而导致错误。实际错误是:C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(724,5): error : The OutputPath property is not set for project 'projectname.csproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Release' Platform='AnyCPU'. This error may also appear if some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

你在 project.json 中指定了运行时 ID 吗? - Enfyve
@Enfyve 是的,它被设置为:"runtimes" : {"win7-x64": {}}。然而,我认为VS可能正在寻找构建配置的.xproj文件,但它找不到...我不确定是否可以在.xproj文件中设置? - Peet Whittaker
1个回答

1
你可以在 project.json 文件中使用 buildOptions 元素指定目标平台:
{
  "buildOptions": {
    "platform": "x64"
  },
  // other stuff
}

2
我已经有这个设置了。不幸的是,Visual Studio似乎无法在VS内部构建时识别它... - Peet Whittaker

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接