Visual Studio setup /createtransform mode fails when the source files are marked read-only

Recently, a customer reported an issue to me with Visual Studio 2005 setup, and I have verified that this issue exists in both Visual Studio 2005 and Visual Studio 2008 setup.  I want to describe the details about this issue and how to work around it in case anyone else runs into it while trying to deploy VS 2005 and/or VS 2008 on their networks.

Description of this issue

Both Visual Studio 2005 and Visual Studio 2008 setup have an administrator install mode that allows you to create a Windows Installer transform (MST) to enable deployment of Visual Studio via a Group Policy object in an Active Directory environment.  This mode is invoked by running <VS Install Path>\setup\setup.exe /CreateTransform <path to MST file> (an example is described in the Visual Studio 2005 deployment readme.

Behind the scenes, when VS setup is run with the /CreateTransform switch, it copies the original MSI file (vs_setup.msi) to the %temp% directory in order to modify it and create a transform based on those modifications.  However, it does not modify the file attributes when copying the MSI to %temp%.

This means that if the MSI is marked as read-only, it will be copied to %temp% as a read-only file, and then setup will fail because it cannot modify the read-only MSI file in order to to create the transform in this scenario.

The most common case where this bug is encountered is by running setup with the /CreateTransform switch directly from a VS installation CD or DVD.  In most cases, the files are copied to %temp% with read-only attributes when setup is run from CD/DVD media.  This bug can also occur if you run VS setup from a network path where the files staged to the network have been marked as read-only.

How to work around this issue

In order to work around this bug, you will need to make sure that the VS setup files are not marked as read-only before running setup with the /CreateTransform switch.  The easiest way to achieve this is to copy the contents of the installation CDs/DVD to a network share and then verify that the files are not marked read-only by right-clicking on the root folder and verifying that the read-only attribute is unchecked.