How to create custom snippet in Visual Studio?

1 minute read

To improve the programming productivity, you can your personal snippet in visual studio. If the work occurs repeatly, the snippet can dramatically reduce your time.

Here I’ll introduce to you how to do it. :)

Firstly create a snippet file for copyright.

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="">
  <CodeSnippet Format="1.0.0">
      <Description>Code snippet for copyright notice</Description>
      <Author>author name</Author>
		<Literal Editable="false">
			<ToolTip>Class name</ToolTip>
      <Code Language="csharp">
        <![CDATA[// --------------------------------------------------------------------------
                // <copyright file="$classname$.cs" company="My company">
                //   2013
                // </copyright>
                // <summary>
                //   The $classname$ class.
                // </summary>
                // -----------------------------------------------------------------------------------

Then import your snippet to visual studio.

Goto : Tools -> Code Snippet Manager -> Import. Choose your snippet file and import it.

Then, you can use the snippet in your visual studio.

Enjoy coding!

SUN Jiangong

SUN Jiangong

A senior .NET engineer, software craftsman. Passionate about new technologies.