Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Visual Studio save code blocks that are dragged on the Toolbox

You can drag and drop code blocks from the Codeeditor to the Toolbox of VisualStudio, but where does Visual Studio save those code blocks.

Are they globally available (for other projects) or only available in the solution/project they are dragged?

like image 532
Jehof Avatar asked Feb 02 '11 09:02

Jehof


1 Answers

Any code blocks that you drag to the Toolbox are stored in your Visual Studio settings file. The default path to that file is under your "My Documents" folder:

..\My Documents\Visual Studio 2010\Settings\CurrentSettings.vssettings

but of course, the exact location can be specified from the Options dialog in Visual Studio.

They are globally available for all projects in the applicable language. For example, if you create a code snippet in a C# project, it will be available for any C# projects that you create. However, it will not be available in a VB.NET project.

Also note that you can rename the individual snippets by right-clicking on them in the Toolbox, and selecting "Rename Item" from the context menu.

But there is a better and much more powerful way to manage code snippets rather than dragging them to your Toolbox. See this article on Sara Ford's blog (a great resource for tips and tricks relating to VS).

like image 68
Cody Gray Avatar answered Oct 19 '22 06:10

Cody Gray