views:

1165

answers:

6

I have been used to working with VS2005 and 2008 - using msbuild, etc, but I have inherited a set of projects that have to remain in vc6.0 for now. I don't like opening each project in the developer studio and building. I prefer to build form command line (I am automating the builds). Is this possible?

I have tried the nmake utility, but I still need to open up the projects and save/export the make file. This is tedious if the project changes - each time I have to save the make file. nmake seems to work, but it had a problem when I changed the location of the project in my directory tree (I checked out of svn into a new clean dir to try the build). It seemed to have hard coded paths in it, but I will have to check on that - it might have been a different problem.

Any alternatives out there?

Eventually I will migrate these to 2008, but for now that is not an option.

A: 

We use automated builds at my work place. Essentially just a batch file i fire off from the command line. Let me make sure i am allowed to post some sample code before i go ahead and post it. But yes, it IS possible to automate the build.

Sample Code:

:::::::: CompileSolution :::::::::::::::::::::::::

call X:\BuildTools\bin\BuildVbProj.bat %COMPONENTNAME% %SOLUTIONDIR% %PROJFILE% %BUILDOUTPUTFILE% %PREBUILDFILE% if %ERRORLEVEL% NEQ 0 goto BuildErrors

goto Cleanup

EDIT: The BuildVbProj.bat file ultimately calls VB6.exe in the Program Files\MS Visual Studio\VB98\ folder. Try calling it with "VB6.exe /?" or "VB6.exe -?" and it will show you a list of options. You can basically automate your process using those options.

There should be a similar exe for VC in the VC98 folder as well.

Mostlyharmless
thanks. All the msdn docs I see are all 2005 releated - none for vc6. Or if it is it only tells me some useless "commands" - all the rest is nmake
grrr... i have no idea how to display "as code" also, I am not exactly sure WHAT you are looking for... I am new to the build thing myself. Too bad they dont teach that in school
Mostlyharmless
Is BuildVbProj.bat part of VB or your own script? I have a similarly remarkable batch file which this margin is too small to contain. :-)
Adam Liss
Its our own script. I inherited it from someone who inherited it from someone in 1999. It makes a call to BuildVbProj.exe which I have no idea who wrote.
Mostlyharmless
A: 

of course you can automate. I haven't used vc in years, but I think the compiler is called c8.exe or wow, I can't remember silly little tidbits like that anymore, but look in your vc\bin directory at all the exes and it will be obvious by name. you can write a batch file worst case. But I also remember the UI having a "create makefile" function. So you do that once, and then just run make from the command line and voila. or maybe it's nmake. Again, been a long long time.

stu
+2  A: 

I think I found m answer here: http://msdn.microsoft.com/en-us/library/aa699274.aspx

thanks all

A: 

Microsoft provides a command line driver for building Visual Studio projects. In VC6 it's called "msdev" (do msdev /? for a list of options).

At some point (probably VS.NET/VS 2002) they started calling the command line build driver "devenv" for some reason. It has a somewhat different syntax, but for driving builds the options are the same or similar.

Michael Burr
A: 

I'm recording the most important part of your link here - Microsoft has a bad habit of moving stuff around and leaving dead links. Not only is this the most important bit, but it gives enough information to do a search if/when they move it.

Building a Project from the Command Line

You can build a Visual C++ project from the command line without first exporting a makefile (MAKEFILE, or filename.mak) and using the NMAKE utility.

The basic command syntax is

msdev FileName [/MAKE "ProjectName – ConfigName | ALL"] [/REBUILD /CLEAN /NORECURSE /OUT LogFile /USEENV]

where FileName is the name of your project (.dsp) or workspace (.dsw) file.

Mark Ransom
A: 
EvilTeach