4

Is it possible to change the build platform from Any CPU to x64 for an ASP.NET Core project within VS 2015?

Every time I try to edit it via the configuration manager it reverts back to Any CPU. Even editing the solution file (.sln) didn't work as VS silently reset it when it next reloaded the project/solution... It appears to be the same issue as reported here.

I ask because it is "stuck" on Any CPU and this is causing errors when building the project as it references other projects which are only configured for x64 platform. The actual error is:

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.

Peet Whittaker
  • 750
  • 6
  • 31
  • Have you specified the runtime IDs in the `project.json`? – Enfyve Oct 26 '16 at 16:07
  • @Enfyve Yes, it is set as: `"runtimes" : {"win7-x64": {}}`. However, I think VS is probably looking in the .xproj file for build configuration, where it cannot find it... I'm not sure if it's possible to set in the .xproj file? – Peet Whittaker Oct 27 '16 at 08:12

1 Answers1

1

You can specify a target platform using the buildOptions element in the project.json file:

{
  "buildOptions": {
    "platform": "x64"
  },
  // other stuff
}
Will Ray
  • 10,621
  • 3
  • 46
  • 61