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

3.9k views Asked by At

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?

1

There are 1 answers

1
Cody Gray - on strike On BEST ANSWER

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).