Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

How to repair a Visual Studio 2005 Express Edition without redownloading the source files

How to repair a Visual Studio 2005 Express Edition without redownloading the source files

  • Comments 0

While trying to configure Visual C# 2005 Express on my laptop as I prepared for my trip home for the holidays, I discovered some interesting behavior in the setup package that I wanted to post about.  This story began after I installed the product and then attempted to repair it by going to the entry for Microsoft Visual C# Express Edition 2005 - ENU in the Add/Remove Programs control panel.  I was expecting the installation program to cache a local copy of the C# Express setup files similar to how the .NET Framework 2.0 does (which is described in more detail in this blog post), but the design for repair for the Express Editions ended up changing in between the time I left the Visual Studio setup team and the time that VS 2005 shipped and that was not the case.

Instead, when setup loaded, I was first presented with a set of options - add optional products (such as SQL Express or MSDN), repair, or uninstall.  When I chose the repair option, I reached a screen that asked if I wanted to browse to the source location or if I wanted to go to the internet and re-download the source files.  I decided to try to use the copy of the files that I found installed on my system in the folder named C:\Program Files\Microsoft Visual Studio 8\Microsoft Visual C# 2005 Express Edition - ENU (which I thought was the cached source files for repair based on the names and sizes of the files in that folder).  This screen looked like the following:

Visual C# Express Edition setup source location dialog

After browsing to the path and clicking Install, I got the following error message telling me that setup was unable to locate the product to repair it:

Visual C# Express Edition setup unable to locate the product dialog

Since I had seen similar error messages in the past, I decided to try to figure out exactly what setup was doing behind the scenes.  As an experiment, I created a blank folder named WCU inside of the folder named C:\Program Files\Microsoft Visual Studio 8\Microsoft Visual C# 2005 Express Edition - ENU (this folder structure mimics what the original installation folder structure looks like).  This time when I clicked Install, I did not get the "unable to locate the product" error dialog and repair appeared to start for me.  After a couple of minutes, I was prompted for the source location of the setup package for Windows Installer 3.1 with a dialog that looked like the following:

Visual C# Express Edition setup missing file error dialog

I was able to manually place the setup packages for each of the prerequisites in the locations that setup was expecting them and then click OK on the Insert Disk dialog to finally get repair to complete.

Based on the above experience, I want to present a couple of options that you can use to repair the Visual Studio 2005 Express Editions without needing to access the internet.  This allows you to enable offline repair scenarios like the one I was trying to accomplish with my laptop.  There are 2 options that I was able to get to work successfully:

1.  Repair only the main Express Edition MSI package using a Windows Installer command line

In this option, you can repair the Express Edition you have installed without repairing any of the prerequisites.  This option works best if you already know that the prerequisites are correct and do not need to be repaired (or if you don't mind manually repairing the prerequisites separately since they each have their own Add/Remove Programs entry that you can use for repairing them).  This option does not require any manual downloading of packages.  However, you cannot use the setup UI provided in the Express Edition Add/Remove programs entry to perform this type of repair.  To use this option, you need to run a command line that looks like the following:

msiexec.exe /fvecms "C:\Program Files\Microsoft Visual Studio 8\Microsoft Visual C# 2005 Express Edition - ENU\vcssetup.msi"

The exact command line will vary based on what Express Edition you have installed and where it is installed.  The most reliable way to figure out the path to use is to search for the MSI file that you will need based on the following list, and then building the command line using the path that this file is located in:

2.  Manually download and copy the prerequisite packages that setup tries to repair

In this option, you will manually download each of the prerequisite packages that setup tries to repair and copy them to a location that setup can use when you launch a repair from the Express Edition Add/Remove Programs entry.

The following steps should allow you to download and store the prerequisites and repair the Express Edition from Add/Remove Programs for a 32-bit OS:

  • Locate the folder that is similar to the following - C:\Program Files\Microsoft Visual Studio 8\Microsoft Visual C# 2005 Express Edition - ENU.  The exact name of this folder will vary based on which Express Edition you have installed and where it is installed.
  • Create a folder named WCU in this folder
  • Create a folder named msi31 in the WCU folder
  • Download Windows Installer 3.1 and save it into the msi31 folder
  • Create a folder named dotnetframework in the WCU folder
  • Download the .NET Framework 2.0 and save it into the dotnetframework folder
  • If you are installing a non-English Express Edition, download the matching language of the .NET Framework 2.0 language pack and save it into the dotnetframework folder
The following steps should allow you to download and store the prerequisites and repair the Express Edition from Add/Remove Programs for a 64-bit OS:
  • Locate the folder that is similar to the following - C:\Program Files\Microsoft Visual Studio 8\Microsoft Visual C# 2005 Express Edition - ENU.  The exact name of this folder will vary based on which Express Edition you have installed and where it is installed.
  • Create a folder named WCU in this folder
  • Create a folder named dotnetframework in the WCU folder
  • Create a folder named x64 in the dotnetframework folder
  • Download the .NET Framework 2.0 and save it into the x64 folder
  • If you are installing a non-English Express Edition, download the matching language of the .NET Framework 2.0 language pack and save it into the x64 folder

After following one of the above sets of steps to download the necessary prerequisite packages, you can do the following to repair the prerequisites and the Express Edition:

  • Launch Express Edition setup from Add/Remove Programs
  • Choose the radio button labeled Repair or Reinstall and click Next
  • Choose the radio button labeled Yes, I have the installation media
  • Browse to the folder that is similar to the following - C:\Program Files\Microsoft Visual Studio 8\Microsoft Visual C# 2005 Express Edition - ENU.  The exact name of this folder will vary based on which Express Edition you have installed and where it is installed.
  • Click Install and repair will begin using the prerequisite packages you previously downloaded and saved in the WCU folder underneath the folder you browsed to

 

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post