Extensibility of Visual Studio IDE

Visual Studio IDE is a highly extensible and customizable application. In this article I will take you through a few extensibility features of Visual Studio that are not only helpful but are nice to know.

Visual Studio 2010 provides a separate section for the extensibility projects as shown in Fig 1.0.

Visual Studio 2010 New Project
Fig 1.0: Visual Studio 2010 New Project

Visual Studio Shell

Visual Studio Shell is the skeleton of the actual Visual Studio, which provides all basic IDE features like the code editor, solution explorer, etc. both not integrated with any programming languages. Visual Studio shell is available in two modes.

Integrated Mode

Visual Studio Shell works in an integrated mode with the actual Visual Studio IDE. You can integrate your own languages and tools into this shell and can improvise it to work as a development environment for your own language. The integrated mode Visual Studio Shell can be downloaded from here.

Isolated Mode

This mode of the shell is completely independent of the Visual Studio IDE. You can use it to develop power tools like a custom source code editor or your own branded IDE with its own features. Since most of the basic IDE features are provided by the shell it saves you a great amount of development effort. You only concentrate on the extra features required for your custom IDE. The isolated mode Visual Studio Shell can be downloaded from here.


If you are a developer wondering how Visual Studio manages to put the default content for a class file for example, then the answer for you is it’s all the magic done through by the Visual Studio templates. As the name explains these are the pre-defined templates that are installed along with the Visual Studio. Visual Studio templates are .zip files, which have the template files with place holders and one .vstemplate file containing the metadata about the template. These templates are language specific since the syntax is not the same between two languages. There are two major template types in Visual Studio.

1.Item Template When you right click on a project in the solution explorer and say Add New Item then the list of item templates will be shown (User Control, Class, Interface, etc.). The in-built item templates for C# language will be available at C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp.

2.Project Template The list of templates that are displayed when you select Add New Project are the in-built project templates. These templates are located at C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp.

The important point here to note is that Visual Studio allows you to create your own project / item template, which can be used in your project or can be shared with your team.

Creating Your Own Project Template

In this section let's look at creating a project template that is a class library, has a class, an interface and refers only to the library System. The simplest way is to create such a project and save all the files. Take the .csproj file along with the class and interface files in the project, create a .vstemplate file named MyProject.vstemplate. Add the below XML content to the file.

<?xml version="1.0" encoding="utf-8"?>
<VSTemplate Version="3.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
              <Description>This is my custom project</Description>
              <Project File="ClassLibrary1.csproj" ReplaceParameters="true">
                     <ProjectItem ReplaceParameters="true" TargetFileName="Properties\AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
                     <ProjectItem ReplaceParameters="true" OpenInEditor="true">MyClass.cs</ProjectItem>
                     <ProjectItem ReplaceParameters="true" OpenInEditor="true">MyInterface.cs</ProjectItem>

Zip all the files into a single file and place it in C:\Users\<user name>\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\. Now open up Visual studio 2010 and select Add New Project. In the project list notice the MyProjectTemplate is listed as shown in Fig 2.0.

Fig 2.0: MyProjectTemplate

When you create the MyProjectTemplate project you will find the expected items in the project as configured in the template.  Fig 2.1 shows the sample project structure.

Sample project structure
Fig 2.1: Sample project structure

Code Snippets

Code snippets act as a short cut in the Visual Studio code editor for a repeatedly used code format, like a property with a get and set accessors.  To insert such a property just type prop and do a double tab, that is a property is created with a get and set accessor.  The in-build code snippets are available at C:\Program Files\Microsoft Visual Studio 10.0\VC#\Snippets\1033\Visual C#\ and are simple XML files. These code snippets can also be extended. Extension of the code snippet file should be .snippet. The example below is a sample snippet to insert code where text with the current date is written to the console.

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
       <CodeSnippet Format="1.0.0">
                     <Description>Code snippet for to print a custom text with current date.</Description>
                     <Author>Arun Karthick</Author>
                     <Code Language="csharp">
                           <![CDATA[Console.WriteLine("Today's date is {0}", DateTime.Now.Date);]]>

Name the file as cd.snippet and place it at C:\Users\<user name>\Documents\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets\. Now in the code editor type cd and do a double tab, which will insert the below statement.

Console.WriteLine("Today's date is {0}", DateTime.Now.Date);

I hope this article has given an overview about the main features of Visual Studio IDE, which most developers would be interested in. Happy reading!

Related Articles


  • Thanks

    Posted by extendcode on 06/30/2012 12:36am

    Thank you very much for sharing the information. I just wish the Help Docs supplied with the software was as easy to read and understand. Keep up the good work!!! software development india

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Lenovo recommends Windows 8 Pro. "I dropped my laptop getting out of the taxi." This probably sounds familiar to most IT professionals. If your employees are traveling, you know their devices are in for a rough go. Whether it's a trip to the conference room or a convention out of town, any time equipment leaves a user's desk it is at risk of being put into harm's way. Stay connected at all times, whether at the office or on the go, with agile, durable, and flexible devices like the Lenovo® …

  • U.S. companies are desperately trying to recruit and hire skilled software engineers and developers, but there's simply not enough quality talent to go around. In response, companies often resort to inferior solutions -- hiring substandard developers and engineers, recruiting talent on a part-time or temporary basis, poaching people from competitors, or burdening an already stressed IT staff for more of their labor. Fortunately, there's a better solution. Read this white paper to learn the business value of …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date