Is there anyway to use compiler constants in Build Events in Visual Studio - VB.NET? (especially in Post-Build events)
Scenario
If TEST_EDITION=TRUE
is defined I want to run an executable during the Post-Build event so if it's FALSE
then I'll run something else.
This can be used for creating different installers for different editions.
P.S. Before someone suggests: No I don't want to use nant, msbuild or something like that
Yes, the $(DefineConstants) macro is available and can be tested in a build event. For example, Project + Compile, Advanced Compile Options, Custom constants = Test can be tested like this:
if /i "$(DefineConstants)" NEQ "TEST" goto skiptest
echo Setting up for test environment
:skiptest
More complicated custom constants like Test=TRUE or compound constants need to be parsed differently. Admittedly I quickly gave up trying to figure out how to use the horrid FOR command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With