4

It's possible to define your own custom templates for normal project types, such as templates for C# files, for a Class Library project.

What about a 'Database Project' scenario?

I would like to define a standard template for adding a stored procedure, which uses the company's conventions for all stored procedures, such as standard comments at the top.


After looking through an MSDN article on the topic, it seems as though the Database Project isn't supported:

Figure 5 TemplateData Elements for an Item

ProjectType | Indicates the type of project that this item can be added to. Possible values include CSharp, VisualBasic, VisualC, JSharp, and Web.

Community
  • 1
  • 1
Jonathan
  • 32,202
  • 38
  • 137
  • 208

4 Answers4

1

you can created customized project item templates for the database project , we do it all the time

the item must be placed in the following folder:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\Templates\Database Project Items

and then you can select it

  • Take a look at the answer to this question [http://stackoverflow.com/questions/451032/how-to-edit-default-templates-for-database-objects-using-vsts-2008-database-editi] I think it covers what you are looking for as the path C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\Templates\Database Project Items doesn't appear to work in VS 2008. – Born2BeMild Jan 25 '11 at 16:42
1

Found it:

C:\Program Files\Microsoft Visual Studio 10.0\VSTSDB\Extensions\SqlServer\Items

It's not the project template you're after, it's the item templates for each type of object.

Scott Herbert
  • 334
  • 2
  • 10
1

You can achieve the same result using code snippets. Once you have created your snippet (I copy/pasted one of the built-in SQL snippets), right click in your script file and select "Insert Snippet..."

The keyword replacement works nicely.

Daniel P
  • 721
  • 6
  • 6
0

Please see: Create Reusable Project And Item Templates For Your Development Team

VS Ref: Visual Studio Templates

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541
  • This is a fine guide to creating templates for *supported* project types. However, it seems that the 'Database Project' type isn't supported. Refer to Figure 5: 'TemplateData Elements for an Item', under 'ProjectType'. – Jonathan May 05 '10 at 02:02
  • 1
    If I'm reading this forum post correctly, http://social.msdn.microsoft.com/forums/en-US/vsx/thread/d5ff6005-d5b2-4087-a725-a370981f614e, it can't be done. – Mitch Wheat May 05 '10 at 02:16
  • Yup... guess I'm writing an email to Microsoft :) – Jonathan May 05 '10 at 02:49