Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change "Visual Studio 2017" folder location?

How do you change the location for the "Visual Studio 2017" directory that is created under %USERPROFILE%/Documents?

In 2015 and earlier, you could move all the folders out of "My Documents" by editing the registry, but those values seem to have moved for VS2017:

The old way: Change "Visual Studio 2010" folder location

Update

I have changed the default Projects and Templates locations, but these directories persist in My Documents:

Directories in My Documents

like image 752
Duodenalsalmons Avatar asked Mar 09 '17 18:03

Duodenalsalmons


People also ask

How do I change the location of Visual Studio 2017?

In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.

How do I change folder location in Visual Studio?

If you've already installed it and want to change the location, you must uninstall Visual Studio and then reinstall it. In the Shared components, tools, and SDKs section, select the folder where you want to store the files that are shared by side-by-side Visual Studio installations.

Can Visual Studio be installed on D drive?

No, unfortunately most of Visual Studio still gets installed on the main drive. Regarding to this forum thread 75% of VS gets installed on the main drive and just 25% on the chosen drive. So you have no choice but to make space on your c drive.

Where are Visual Studio files stored?

When you create a new project, Visual Studio saves it to its default location, %USERPROFILE%\source\repos. To change this location, go to Tools > Options > Projects and Solutions > Locations.


2 Answers

(Starring this question because I'm going to need this answer for the next release of Visual Studio, I bet... And I forget this every time I set up a new machine. I cobbled this together last time from a bunch of different sites, but unfortunately my google-fu cannot find them again, so my sincerest gratitude to those unnamed developers.)


Finally, a question I can answer! I, too, have spent countless hours trying to fix this. The commenter on your question is correct--the settings are still controlled by the same registry keys, it's just that the location of those has been moved following the switch to a different installer. Lo and behold:

  • Previously, Visual Studio installed many registry keys into the system’s HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER hives under a Visual Studio-specific key:
    • HKLM\Software\Microsoft\VisualStudio\Version: [...]
    • HKCU\Software\Microsoft\VisualStudio\Version: [...]
    • HKLM\Software\Microsoft\VisualStudio\Version_Config: [...]
  • To reduce the impact on the registry, Visual Studio now uses the RegLoadAppKey function to store registry keys in a private binary file under %VsAppDataFolder%\privateregistry.bin. [...]

So in essence, what you need to do is to find that file, load it in a registry editor (such as regedit.exe), change the values to your liking, and then save the file in the same format. On my machine, the file was located in:

C:\Users\Ernest\AppData\Local\Microsoft\VisualStudio\15.0_dfee2c30

Not censoring my username 'cause it's pretty obvious anyway. The following is how to use regedit.exe to do the editing:

First, select somewhere to load the registry hive (I used HKEY_USERS). It doesn't really matter as long as you don't overwrite something when loading the hive (it will warn you). With that key selected, go to File > Load Hive..., and open the aforementioned privateregistry.bin file. Type in a Key Name to load it under (e.g. "VS2017_config"), and you'll see the familiar keys used in past versions to configure paths. Change those. When you're finished, select the hive which you loaded (e.g. "VS2017_config"), and go to File > Unload Hive.... This should set folder paths correctly.


Do note that those folders will pop up again the first time you use Visual Studio Blend, so remember to change those as well if you ever plan on using that.

Edit: The corresponding registry hive for Blend was here for me:

C:\Users\Ernest\AppData\Local\Microsoft\Blend\15.0_dfee2c30


Edit 2018: @ofthelit has kindly posted an official page with the relevant info.

like image 67
Ernest3.14 Avatar answered Sep 22 '22 21:09

Ernest3.14


Or (in Visual Studio 2017) just go to tools >> options >> projects and solutions >> Locations

enter image description here

like image 36
David Avatar answered Sep 19 '22 21:09

David