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

是否可以在VS 2015中将构建平台从Any CPU更改为x64 for ASP.NET Core项目?

每次我尝试通过配置管理器进行编辑时,它都会恢复为任何CPU.甚至编辑解决方案文件(.sln)也不起作用,因为VS在下次重新加载项目/解决方案时默默地重置它…它似乎与报告的here相同.

我问,因为它“卡在”任何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文件中的buildOptions元素指定目标平台:

{
  "buildOptions": {
    "platform": "x64"
  },
  // other stuff
}
点赞