How to create a minimal Visual C++ install

PT 15-Jul-2004 The standard installation of Microsoft Visual Studio is some 400MB. I recently needed to do some debugging on a machine that I didn't want to install VC6 on (because it can be hard to properly uninstall). However, if all you need is VC6 to compile stuff, then you don't need all the other stuff. Here is how. Note that my target was building tcl - if you are building something else you may need to copy a few more bits.

Create the following directory tree.

 vc6
 |-bin
 |-include
 |-lib

Copy the whole of lib and include directories from your VC98\ to your new tree. Then copy from the VC98\bin directory to your bin directory cl.exe, c1.dll, c1xx.dll, c2.dll, cvtres.exe, lib.exe, link.exe and nmake.exe Then copy from MSDev98\bin to your bin mspdb60.dll, rc.exe and rcdll.dll.

Setup a vc6setup.bat file with the following to create a build environment

 echo Setting environment for minimal Visual C++ 6
 set MSVCDir=drive:\path\to\vc6
 set INCLUDE=%MSVCDir%\include
 set LIB=%MSVCDir%\lib
 set PATH=%MSVCDir%\bin;%PATH%
 Title Minimal VC6 build shell

You can now open a new command shell and run the batch file to setup a build shell. To build tcl you can now cd to tcl\win and do

 nmake -f makefile.vc OPTS=none release

The installation takes about 70MB disk space so can easily be put on a USB memory stick if needed.

Once you have finished on the target system a simple rmdir /q /s vc6 will get rid of the whole lot.


With Platform SDK

Obviously under windows you should always build stuff with the most recent headers and libraries you can get - which means the Platform SDK - this is a free download from Microsoft. If you want to apply this to the minimal installation given above, you simply need to copy the Platform SDK include and lib directories on top of your minimal ones. The result is an up-to-date command-line build environment weighing in at about 100MB with no entries in the registry to worry about.

APN 20101015 As per Pat Thoyts on the chat, if you are building with VC++ 6, you cannot use an SDK later than Feb 2003 SDK as the libraries supplied in later SDKs are not compatible with the VC++ 6 linker. Turns out this SDK is not visible on Microsoft's download pages but can still be downloaded from their servers. Copy the files

 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.1.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.2.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.3.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.4.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.5.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.6.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.7.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.8.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.9.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.10.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.11.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.12.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.13.cab
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/extract.exe
 http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/FULL/PSDK-FULL.bat

to a local directory and then run the PSDK-FULL.bat batch file to install it. Or you could just extract the contents from the cab files and use the lib and include directories from there.


IDE

The Visual studio IDE is also capable of being quite stand-alone. If you copy the MSDev98 directory from its normal location into the minimal VC6 tree (ie: to vc6\msdev98) you just need to set the MSDevDir environment variable and add %MSDevDir%\bin to the path to be away. (Remember to start msdev.exe from the command line so that it inherits the environment that lets it know where the compiler is installed.)


See also Building Tcl with the free VC++ toolkit, C