Visual Studio 2008 sometimes resets Platform back to "Any CPU" from "x86"

771 Views Asked by At

I have a multi-project solution where I've set the Platform for all projects to "x86", using Configuration Manager. It's set this way for both Debug and Release builds, in all projects.

Twice now, Platform has reset itself back to "Any CPU", and I've had to go into Configuration Manager again to fix it.

Today, it happened after I got a new working copy from Subversion, but I'm not sure if that's what happened the last time.

Any suggestions on why this might be happening, and how to prevent it in future?

2

There are 2 best solutions below

4
On BEST ANSWER

I think the selected build is a user preference, so if you check out a clean copy, you will start with a blank user pref. file. VS then would default to the first in the list, which is probably 'any cpu'.

0
On

I came up with a way to at least detect the problem when it happens.

Added the following to the Pre-build Event Command Line:

rem EXIT WITH ERROR 99 IF PLATFORM IS NOT x86. (CHECK CONFIGURATION MANAGER)
if $(PlatformName) NEQ x86 exit 99

If the Platform setting changes, I now get an error when I build the project.

Crude, but it works.