New projects not built when the target platform is explicitly installed

I create a new solution with one project, and then change the target platform from "Any processor" to "x86". After the newly added projects are not built by default, their target platform will not follow the global settings. What for?!

Looking at the configuration manager, newly added projects are not checked for "Build", and they get the target platform "Any processor" instead of the global x86. Why is this happening? I expect new projects to also receive the globally installed and specific x86 target platform. Some things I tried:

  • Switch the global platform back to any CPU, and then to x86 again. Without changes..
  • Choosing a platform for a new project. x86 is not available in the list, and when I say <New..> and try to add it, I am not allowed as ".. a solution platform with the same name already exists."
  • In the build properties for the new project, I cannot change the platform in the "Configuration" section, but I can set the "Target of the platform" to x86 in the "General" section. However, it is unclear whether this really matters, and he would not answer if I change the target platform later.

Initially, I thought it was a problem with converting my solution from VS2008 to VS2010, but the problem applies to both places. That is, when I create a solution in VS2008 and just stay in VS2008, I still get the problem.

+4
source share
2 answers

Yes, this is a very weak change in VS2010 and a bit of a mess. New solutions created in 2010 will have two configurations: "Debug | x86" and "Release | x86". This differs from the solutions created by previous versions, "Debug | Any CPU" and "Release | Any CPU" were standard.

When you add an existing project created in a previous version to this solution created by VS2010, you will get a nasty mixed package. The combination of platforms now shows three options: "x86", "Any processor" and "Mixed platforms". The latter will build all the projects. What is also very confusing is that the configuration name does not actually directly affect the setting of the Target Platform.

This fix, you can search and replace "Any processor" with "x86" in the .sln and .vcproj files using a text editor. The best approach, perhaps, is to get out of trouble and let VS2010 transform the VS2008 solution instead of creating a new one. Yucky problem.

+4
source

Steps:

  • Close the project
  • Open csproj file in notepad
  • replace all x86 with x64, save
  • Restart the project and it works.
+1
source

Source: https://habr.com/ru/post/1309095/


All Articles