Visual Studio and moving My Documents

Tonight, I encountered a problem again and one which I think Visual Studio should really be clever enough to handle and know.

On all of my machines, I move My Documents folder onto a separate partition for management, backup and just simply because I don’t want all of my work on the main OS partition – if Windows goes down its a lot easier to recover data if its on a separate partition, of course if the drive dies I have a backup just in case.

However, Visual Studio seems to have a big problem with this. After moving the folder, VS still tries to save and find items in the original location (C:UsersUserNameDocumentsVisual Studio 2005). The first time I did this was when I saved a project template into F:UsersUserNameDocumentsVisual Studio 2005 , and for some strange reason VS wasn’t picking it up. Turns out, it was still looking in the old default location. Tonight, I installed an add-in which was installed into the correct place – F:UsersUserNameDocumentsVisual Studio 2005Addins, yet Visual Studio was not setup to look in this location. There were environment variables set in the addin dialog, but nothing matching what was actually setup on my system. I can’t believe I am the only person who moves their Documents folder and who has ran into this problem.

To make Visual Studio look in a new locations, in Tools > Options > Environment > Addins add a setting for your Addin directory in VS2005 directory, and then move all the locations in Tools > Options > Projects and Solutions to your location. Then the only place you have to worry is making sure when you save a project, it is saved in your new location – or where ever else you want.

But really, we shouldn’t have to do this. Visual Studio should be working off the relevant path to my documents, and not a hardcoded path which it seems to be. It’s hardly best practice…and it is still the same in 2008.

2 thoughts on “Visual Studio and moving My Documents”

What’s worse is, the registry key HKCUSoftwareMicrosoftVisualStudio8.0 contains all of the default directories. Try changing the reference from %USERPROFILE%… to the new location and VS tells you it knows better and sets them all back again… Please!

Obviously, the second key only applies to those users of Visual C# Express. People who use VB Express or the full blown VS will have to look for their respective keys…. You can find more details about this tweak on the link below.