Command line compile using Devenv.exe

Another entry from Duncan’s blog has some tips on doing a command line compile using vbc.exe.


Another approach you can take is if you have Visual Studio on the machine, use Devenv.exe.  This allows you to easily build multiple projects as defined in a solution (.sln file)  It also takes advantage of the information stored in .vbproj files that list the relevant references.  The syntax is incredibly simple, eg:


Devenv.exe MySolution.sln /build Release


Note how you can specify which build configuration to build (typically Debug or Release)


So, even if you are generating the code files, you might want to generate the vbproj files as well rather than the focus on the vbc command line command.  That way the project can be easily opened in VS.NET as well as easily compiled from the command line.


Hopefully one day in the not too distant future they will release a vbproj pre-processor that passes the info off to vbc.exe, hence allowing simple command line compiling without the need for VS.NET on the machine



1 Comment so far

  1.   Duncan Mackenzie on September 20th, 2004          

    Of course, my info was aimed at people without VS.NET, because if they have VS.NET, they don’t need to automate builds from the command line for a small project like the one described, but you bring up an interesting point about the future…

    "Hopefully one day in the not too distant future they will release a vbproj pre-processor that passes the info off to vbc.exe, hence allowing simple command line compiling without the need for VS.NET on the machine"

    MSBuild provides exactly that… for VB 2005 of course, but at least we know it is coming, and it is part of the Framework SDK… no VS.NET required.