342Microsoft Visual Studio 2010: A Beginner’s Guide

Key Skills & Concepts

Implement Custom Templates

Create Custom Snippets

Write Macros

In addition to all the great features you’ve seen in preceding chapters, VS gives you the capabilities to customize your own environment. The customizations I’ll discuss are custom templates, custom snippets, and macros.

Throughout the book, you’ve started new projects and added items to those projects, using what is available with VS. On some occasions, you might desire to have a special type of project or customize an existing project for your own needs. The same need might apply to project items (such as a special type of class file), where you might change the contents of an item or create a new item.

Chapter 2 showed you how to use snippets, and Chapters 3 and 4 showed how to use several more snippets to quickly code common statements. In addition to using existing snippets, you can create your own. VS also has a management window that allows you to organize snippets, adding, deleting, and rearranging as you see fit.

Whenever you run into repetitive scenarios, it would be nice to capture the actions you perform so that you can quickly complete a task. For example, if you found yourself using the same set of keystrokes, it would be nice to collapse that action down into one command. Macros allow you to collapse repetitive tasks into a single task, saving you time.

Let’s start the journey of customizing VS by looking at customizing templates.

Implementing Custom Templates

As you’ve seen in previous chapters, VS helps you get started with new projects and project items by providing default project items and skeleton code. In most cases, this is a very quick way to get started with a project. As you become more proficient in VS, you might prefer to have projects with different items than those that ship with VS or item templates with different code. This section will show you how to create your own project and item templates.

Page 365
Image 365
Microsoft 9GD00001 manual Implementing Custom Templates, Key Skills & Concepts