How to move Visual Studio's 'My Code Snippets' folder to another drive?

不想你离开。 提交于 2019-12-02 23:16:49

The UI doesn't make it completely obvious what the buttons are for, but this can actually be done in two simple steps:

Step 1. In Code Snippets Manager, select the folder that points to the disk location you no longer use, and click Remove:

Step 2. Click Add...

...and select your new folder:

That's it! Your new folder is now active in Code Snippets Manager.

Code Snippet folders don't seem to be directly editable in the Visual Studio IDE (that I could find). They are stored as registry entries, so you have to edit these settings directly.

For Visual Studio 2012 the registry settings are located in:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\Languages\CodeExpansions\Visual C#\Paths

The value is called 'Microsoft Visual CSharp', and lists all the different folders separated by semicolons:

%InstallRoot%\VC#\Snippets\%LCID%\Visual C#\;%InstallRoot%\VC#\Snippets\%LCID%\Refactoring\;%MyDocs%\Code Snippets\Visual C#\My Code Snippets\

The quick fix for the snippets would be to provide the full path in place of the %MyDocs% setting.

I couldn't find a reference to how %MyDocs% is defined, but I suspect it's the "Projects Location" setting:

Tools -> Options -> Projects and Solutions/General

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!