Tuesday, December 2, 2008

FIX: Error 1324. The folder path 'Program Files' contains an invalid character.

I just ran into this one yesterday evening while trying to install the service pack to Visual Studio 2008. After doing a lot of searching, I've discovered it's a pretty common problem encompassing not only VS2008, but .Net Framework upgrades and a few other patches.


The Service Pack or update won't install. Upon examining the Log, you get a nonsensical message that a path with no invalid characters has invalid characters.

Other Factors

You're running the 64-bit version of Server 2008 or Windows Vista.

What's actually going on

Well, aside from the installer being completely b0rked, I'm not sure. It appears that at some point just prior to the error, the installer decides that your program files folder is located on a CD, DVD, Unmountable Partition or Virtual CD/DVD drive. To make matters better, it's looking in a helpful location called PFILES on this drive that it cannot write to.

How to fix it

It's almost difficult to write this without a quick facepalm. Microsoft actually documented part of this solution, but I'm going to expand on it a little more.
Step 1: Disable all virtual drives that you cannot write to. (DAEMON Tools, Virtual CD, all of them).
Step 2: This is documented in the KB article, but there's a few points to add. First, if you're installing the service pack or patch from your CD drive, now is a good time to copy it to your hard drive. Right Click "Computer" and choose "Manage", Under "Storage", select "Disk Management". Right click each CD/DVD drive and choose "Change Drive Letter and Paths". Write down the drive letter somewhere, then select the drive letter and click Remove (don't worry, you'll add them back in at the end).
Step 3: Unplug any external or internal drives that have raw or broken partitions, or format those partitions to make them valid. This one caught me as I had a data disaster earlier this year and have three drives that show up with no partition information and one that shows up with a partition with no data. I want to do some recovery on that when I have some time, so I elected not to format (or initialize) any of those drives.
Step 4: If you have any sort of card reader that shows drive letters for each of the card slots when there are no card installed, unplug it.
Step 5: Open up "Computer" and make sure that you have only drives that can be written to (the floppy, if you still have one, doesn't appear to pose a problem).
Step 6: Launch the installer again. Fixed.

Cleaning it all back up

Obviously, reboot if it's required and run the application you upgraded and make sure it works first.
Then plug in what you've unplugged.
Go back into Computer Management and right click each CD drive, select "Change Driver Letter and Paths", click "Add" and put the drive letter back that you removed earlier.