问题
One of the many projects in a very large solution somehow became set to Build Platform == Active (x86). I want it to match all of the other projects ("Any CPU").
I successfully changed the Platform target dropdown from "Active (x86)" to "Any CPU", but the Platform dropdown has "Active (x86)" as the only option:
I don't know how this project got "out of sync" with the others as to this setting to begin with, and more importantly how to get it back in line with the others...
UPDATE
I think the problem may have been that my VS install was set to VB instead of C# (it was done by IT, and most of the cats here are VB developers).
This: http://go4answers.webhost4life.com/Example/buildsolution-configuration-dropdown-188435.aspx mentions Tools | Settings, but I have no such menu item.
I did select the option to reset settings to original, and the "Settings Reset in Progress" dialog has been churning away for nigh on to half an hour now, with VS "(Not Responding")
UPDATE 2
Now I'm having the opposite problem with a Windows CE project - I need it to be "x86" and it refuses to change to that from "Any CPU".
The reason why I want to change this setting is because when trying to run this app on a handheld device I'm getting the "Can’t find P/Invoke DLL sqlcemeNN.dll" err msg.
According to this: "If your machine is a 64-bit box, you might have been got trapped into default target platform 'Any CPU' trap, please set the target platform as 'x86'. Need more details, please visit ErikEJ's blog post."
My machine is 64-bit, and I did read the blog post referenced
...but I have no "x86" option in my Confriguration Manager's "Active Solution Platform" dropdown. "Any CPU" is the only option it gives me...
I was able to somehow force the "Active Solution Platform" dropdown to say "x86" after typing that in, but I don't think it really changed anything. In the grid, the only option is "Any CPU". Selecting "Edit..." (there is no "New...") from the "Project" column just shows "Any CPU" in the list, a greyed-out "Remove" button, and a Close button ("greyedoutprojectplatforms.png")
So what I tried is I changed every instance of "Any CPU" in the project's .csproj file to "x86" and STILL it says "Any CPU" in Project > Properties > Build > Platform Target!
回答1:
Try adding a new build configuration to your project from the solution file (right click it on Visual Studio, properties then go to Configuration Manager.
Otherwise you can manually edit the project file (open the *.csproj with notepad) and add back the rule for AnyCpu http://msdn.microsoft.com/en-us/library/ms734788(v=vs.85).aspx.
It is likely that if you're working in a team with source control and continuous integration, this has been changed by someone to satisfy a requirement on the build server. Probably the cleanest thing to do is add a custom build configuration for your project and use that one on your solution.
来源:https://stackoverflow.com/questions/17621949/how-can-i-change-the-build-platform-property-in-a-visual-studio-project