In Visual Studio 2010 I am trying to make a copy of a dialog template resource with a condition in order to have two different versions of the dialog in two different build configurations.
I have a header file that the .rc file includes which contains this:
#ifdef BUILD_CONFIG1
#define RES_DEFINE_1
#else
#define RES_DEFINE_2
#endif
So, I go to the Resource View in Visual Studio, right-click on the dialog template and choose "Insert copy..." The Insert Resource Copy dialog pops up and I set the condition: RES_DEFINE_2 and click OK.
At this point, everything looks good. I see both the original dialog and the copy with the condition in brackets [RES_DEFINE_2]. I save everything and I'm good to go.
Here is where the problem seems to be. Our version control system is ancient, and based on locking single files. In previous versions of Visual Studio, we've only archived the *.rc files, and made sure that resources were up-to-date by deleting the *.aps files that the resource editor creates. Whenever we needed to edit a resource, Visual Studio would simply regenerate the *.aps file from the *.rc file
But, when I delete the *.aps file in VC2010, and then reload the resource in the editor I'm now missing the conditional resource that I just added. Instead, I see only the original IDD_DIALOGNAME entry. I look in the *.rc file and see what I'm supposed to:
Original dialog:
#if defined(APSTUDIO_INVOKED) || !defined(RES_DEFINE_2)
IDD_DIALOGNAME DIALOGEX 0, 0, 301, 190
...
Copied dialog:
#if defined(APSTUDIO_INVOKED) || defined(RES_DEFINE_2)
#if defined(APSTUDIO_INVOKED)
IDD_DIALOGNAME$(RES_DEFINE_2) DIALOGEX 0, 0, 301, 190
#else
IDD_DIALOGNAME DIALOGEX 0, 0, 301, 190
#endif
...
If I go through adding another copy, I get another template in the resource with no #if
at all:
IDD_DIALOGNAME$() DIALOGEX 0, 0, 301, 190
...
Is the *.aps file no longer completely generated from the .rc file? Has anybody else run into this and have a workaround, or will I be forced to start storing the *.aps files in our version control system?
Update: Yesterday, I could get this bad behavior at will. This morning I showed my boss and he duplicated it. Now, everything seems to just magically work on both my machine and the machine we originally discovered this on. Haven't heard yet if my boss can still get it to happen.
Now nobody can duplicate this issue. We weren't able to find any difference in the steps we took. Lacking any steps to duplicate this, I'm answering it to remove it from the list of outstanding questions.