开发者

How to create item templates for SQL files, for Visual Studio Database Projects

开发者 https://www.devze.com 2022-12-28 23:21 出处:网络
It\'s possible to define your own custom templates for normal project types, such as templates for C# files, for a Class Library project.

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.


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


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.


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.


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

VS Ref: Visual Studio Templates

0

精彩评论

暂无评论...
验证码 换一张
取 消