11

I have a VB project which I'm trying to configure with three build configurations.

I've successfully created the build configurations, but I decided the names I was using weren't descriptive enough so I went to Configuration Manager -> <Edit...> -> Rename and renamed them.

This renamed the configurations in the Configuration Manager.

I then went to do some conditional compilation testing using #If CONFIG = but it failed.

Checking deeper, it turns out that the values returned by CONFIG are the original names not the new names.

Checking My Project -> Compile -> Configuration I can see that the names shown in that ComboBox are also the old names.

So, even though I have "renamed" my configurations in Configuration Manager, they're not being renamed on all levels.

I can get around this by recreating these configurations with their intended names but that's about as bass ackwards a solution as I can think of. Is there some method of renaming configurations that actually works or is this just the way MS intended this to... "work"?

Frosty840
  • 7,965
  • 12
  • 50
  • 86
  • 2
    I think you have renamed only the Solution Configuration and not the individual Project Configuration. Reopen the Configuration Manager and check, on every project line, the name of the configuration. By the way, I agree with you. MS could have done better here. – Steve Apr 02 '12 at 11:58
  • Oh, I *see*. Yes, you're correct, that's exactly the problem. Configurations exist per project *and* per solution and I was only managing one of those. Perfectly sensible and yet utterly crazy at the same time. Classic MS. Thanks. – Frosty840 Apr 02 '12 at 12:52

1 Answers1

12

I think you have renamed only the Solution Configuration and not the individual Project Configuration.

Reopen the Configuration Manager and check, on every project line, the name of the configuration.
By the way, I agree with you. MS could have done better here.

For example, when you create a new solution configuration, you have the option to create the corresponding configuration on the projects. When you rename a configuration this option is missing. It's an inconsistency from MS

Steve
  • 213,761
  • 22
  • 232
  • 286
  • My solution and project files are under source control, specifically Perforce. Although I have their VS source control plug-in installed, it did not automatically check out the .vcxproj files when I attempted @Steve 's answer (rename would not commit). I had to manually check out these files so that the rename action with Configuration Manager would commit. Makes sense, otherwise the project files are read-only. – Steven Darnell Feb 13 '15 at 18:11
  • Of course, it you open the projects file with a simple text editor you will notice the configurations written there. So if you want to change those sections you need to have these files writable. I don't know why you want to keep them read-only. The source control should be here to help with incorrect changes but every shop has the right to have its rules.... – Steve Feb 13 '15 at 18:16
  • In my case, Perforce sets controlled files (like our project configurations) as read-only by default and sets them as writable when they are checked out for editing. The plug-in, which typically performs the checkout automatically, overlooked this particular use case; thus, required manual intervention. (My first comment was just a note to remind myself and others of this little nuance. I forget over time, search for the problem again, find the same SO questions, and find I already up voted the answer previously.) – Steven Darnell Feb 13 '15 at 18:33