Use MSBuild to build old VS6 C++ projects

commandline-build-toolmsbuild

I have a build computer where Visual Studio not installed, only MSbuild which can build VS2008 projcets without having any Visual Studio installed.

I wonder whether it is possible to use MSbuild with VC++ 6.0 project files, although I am thinking this could not be possible. In the past I have used it with a VS2008 solution file for C++, but not for building C++ 6.0 dsw file.

For Vb6 we have an extension package for Msbuild (MSBuild.ExtensionPack.VisualStudio.VB6). Is anything similar available for C++ 6.0 projects?

An alternative could be if there are lightweight build tools that can built VC6++ .dsw files without having to install Visual Studio 6.0 ?

Best Answer

You can't compile C++6 without the C++6 compiler. However, once you install the command line support for the compiler/linker on the build server you will be able to access it from MSBuild or NAnt (worth a look). Also note that VS C++ 6 supported a build tool called nmake which shipped with VS. VS knew how to generate the nmake file for your project, and this might be worth looking into.

I doubt there is a C++ 6 compiler package out there that is separate from VS. Unlike C# and other .Net languages, Microsoft did not have to publish free compilers to gain traction. However, that does not mean you can't create one yourself. They now have C++ compilers (albeit somewhat crippled) for the later versions (VS 2008 and 2010).

You need to create a directory structure that is similar to MS Dev's directory structure, and copy all the relevant files. The command line tools do not require any special registry settings to be set. You will need the command line tools (compiler, linker, nmake, etc.), the header include libraries, and the .lib stubs to compile on a machine without MS Dev installed. It might be easiest to copy the install location and then remove the parts you don't need.

Your build tool (MSBuild, NAnt, or nmake) would use an environment variable to find the root directory of the C++ 6 tools, and then refer to them there. Using this approach, once the single environment variable is set on everyone's computer no changes have to be made between dev machines and the build machine. Your compiler will be able to find the system headers for includes, and the linker will be able to find the requisite .lib files for the DLLs you are using.

Related Topic