Visual Studio Snippets and Templates

The downloadable packages on Codeplex contains a number of templates and snippets which are useful when developing N2 sites.

You need to update the path with your own version of Visual Studio. For example, if you are using Visual Studio 2008 you need to substitute in 2008 for 2010 in the paths below.

Snippets are copied to [Documents]\Visual Studio 2010\Code Snippets\Visual C#\My Code Snippets. Once the snippets have been placed here they can be invoked from Visual Studio by their name and tapping tab twice (e.g. n2propfta [tab] [tab]). This will expand a property with an editable attribute. Available snippets include:

  • n2prop.snippet
  • n2propcb.snippet
  • n2propenum.snippet
  • n2propfta.snippet
  • n2propimage.snippet
  • n2proptb.snippet
  • n2propuc.snippet
  • n2propurl.snippet

Installing Visual Studio Item Templates

The snippets folder also contains some Visual Studio Item Templates that appears when adding new items in Visual Studio. Copy them from the Snippets folder in the template package zip to [Documents]\Visual Studio 2010\Templates\ItemTemplates\Visual C#. The item templates creates a content class and a corresponding template or controller. Available templates:

  • N2 Item Template.zip
  • N2 Page Template.zip
  • N2 Page Controller.zip

Installing IntelliSense Documentation for Visual Studio

The IntelliSense documentation should be installed automatically. If it is not installed, check for ~/bin/N2.xml. This enables code documentation during IntelliSense operations and hovering in Visual Studio.