How to pass MSI command line parameters to Visual Studio setup

I was helping a Microsoft team customize Visual Studio 2005 setup this week. They needed to make some modifications to the VS MSI for some of their development scenarios and in order to do so, they created a transform that needed to be applied during VS setup. As I was helping them, I realized that there is a command line switch for VS setup that is not documented that could be useful to others so I thought I'd write up a quick description here.

Ordinarily, you would be able to install VS by running msiexec /i vs_setup.msi. But, VS setup uses an external UI handler, and we use a strategy similar to what is described here to limit users from running setup without using the UI handler we provide. In order to support passing any arbitrary MSI command line parameters to the VS MSI using the UI handler, we introduced the /msipassthru command line switch. The switch looks like the following:

  • setup.exe /msipassthru=BEGIN"<msi string here>"END

As an example, if you have a transform you want to apply, the command line would be the following:

  • setup.exe /msipassthru=BEGIN"TRANSFORMS=my_transform.mst"END

There are a couple of important things to note when using this command line switch:

  1. The /msipassthru switch only works for the setup.exe that resides in the setup subdirectory on the VS source CD/DVD. It will not work for the setup.exe on the root of the first CD or DVD.
  2. The /msipassthru switch will work for all Visual Studio .NET 2002, Visual Studio .NET 2003 and Visual Studio 2005 products