Compile VB.NET project with different #Const by running a single compile.bat file?

254 Views Asked by At

I can manually do this (without a single problem) to compile my VB.NET code into my stand-alone WindowsForms executable. But is there a way to do this all from a command-line script? I've checked into Vbc, MsBuild, and DevEnv but they all seem to be unable to do 1 (or more) of my needed steps.

  1. Double-click on my foo.vbproj and launch VS2005.
  2. Change a few of my #Const vars from true to false.
  3. Hit F5 to compile it.
  4. Change my #Const back to their original settings.
  5. Exit VS2005.
  6. Enjoy my newly created bin\debug\foo.exe

Any idea on how to do this from a command-line script instead? Thanks.

1

There are 1 best solutions below

0
On

You could define the #consts at the project level, and have multiple project files: each identical but having different constants - foo1.vbproj, foo2.vbproj etc. These constants can be defined in project properties. Then use MSBuild to build each project.