First you need to create a new configuration in VS. I took some images to help in Scott Hanselman’s page.
Go to the Configuration Manager
:
Create a new configuration on the selector you probably already have Debug
and Release
. and choose one of them with copy source. You can create a new version of yours for debug and another to release:
Then you will go to the properties page of your project. In tab Build
you will create a conditional compilation symbol. It would be good to use a name like the name you used in the new configuration created, just to standardize. You will obviously create this symbol by choosing the new configuration you created.
There in your code you will use #if SIMBOLO_CRIADO
to choose whether that chunk of code should be compiled in that version or not.
#if MENU1
ChamaMenu1();
#elif MENU2
ChamaMenu2();
#endif
Documentation of the conditional compilation directive.
Be careful with this, if you abuse you get lost.
Documentation of the settings manager.
Exactly that!
– Thiago Silva