How to work around product key issue with new Visual Studio 2008 silent switches

I previously wrote a blog post describing some new silent install switches that have been introduced in Visual Studio 2008 setup.  Unfortunately, an issue was recently found with these switches that can cause installation to fail.

To summarize the issue, if you attempt to use the /q and /full switches for Visual Studio 2008 setup, and the copy of Visual Studio 2008 that is being installed is not configured to have a pre-populated product key, then setup will fail during the CA_SetPidProps custom action that runs as a part of the main vs_setup.msi.

There are a couple of options that will allow you to work around this issue:

Option 1 - Pass the product key via command line when running setup

You can provide an additional command line parameter to the Visual Studio 2008 setup.exe to specify the product code that will be used during installation.  The command line will look like the following:

<VS install location>\setup\setup.exe /q /msipassthru=BEGIN" PIDKEY=xxxxxxxxxxxxxxxxxxxxxxxxx "END

You need to replace xxxxxxxxxxxxxxxxxxxxxxxxx in the above example command line with the actual 25-character product key for your copy of Visual Studio 2008 with no dashes included.

Option 2 - Add a pre-populated product key to the VS setup data file

You can use the following steps to add a product key to the appropriate Visual Studio 2008 setup data file in order to cause the key to be automatically pre-populated during unattended Visual Studio 2008 setup:

  1. Copy the VS installation files to a location that you have write permission to

  2. Open the file <VS install location>\setup\setup.sdb in a text editor such as Notepad

  3. Go to the end of the file and locate the section named [Product Key]

  4. Press enter and add the product key to the line immediately after [Product Key] so it looks like the following:

    [Product Key]
    xxxxxxxxxxxxxxxxxxxxxxxxx

  5. Save and close setup.sdb

  6. Run <VS install location>\setup\setup.exe /q to install silently and have setup use the product key specified in setup.sdb

You need to replace xxxxxxxxxxxxxxxxxxxxxxxxx in step 4 above with the actual 25-character product key for your copy of Visual Studio 2008 with no dashes included.  You do not need to modify setup.sdb if you already see a 25-character product key listed in this file.