visual-studiovisual-studio-2008code-templates

How does one customize VS 2008 Database Item Templates?


Whereas there is a set of richly informative pages describing Visual Studio templates for code projects (projects and items) in MSDN, there doesn't seem to be a thing for database projects. If I am wrong, please steer me in the right direction. I have VS2008 Professional.

Anyway, my question has to do with the new database items. Presently, the folder

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

contains 6 template files and one other file, NewDataItems.vsdir, which seems to help control how VS uses these 6 templates. I want to create a new template for stored procedures, and I note that if I merely copy the default template and modify it with a new name, it does show up in the Add New Item dialog, but it doesn't use the same icon as the other items. It does work, but I can't help wondering if I appropriately modify the NewDataItems.vsdir file to include it, I could get it to look the same as the other items in the dialog. Here's the contents of the file:

New Stored Procedure Script.sql|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|#6306|30|#6307|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|1052| |#6320
New View Script.sql|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|#6308|60|#6309|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|1051| |#6320
New Table Script.sql|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|#6310|40|#6311|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|1050| |#6320
New SQL Script.sql|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|#6319|10|#6314|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|1054| |#6320
New Trigger Script.sql|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|#6312|50|#6313|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|1053| |#6320
New Query.dtq|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|#6321|20|#6315|{220A4C17-7E7C-4663-BBCC-5E607C6543CD}|1057| |#6322

It's unclear to me what the various elements of this file are supposed to mean, but it looks like the numbered items (#6308, 30, 1052, etc) may control some aspect of the presentation in the dialog. Can someone explain the elements of this file and how to make changes and additions?

Also, the default template New Stored Procedure Script.sql is actually presented in the dialog as "Stored Procedure Script". If I copy and paste New Stored Procedure Script.sql as Special Stored Procedure Script.sql without doing anything more, a new item with an icon different from the original shows up, and when selected and Added goes into the project as expected. But how do I make the icon the same as for the default, and how do I make the name of the item in the dialog something of my choice rather than the filename? ReplyQuote


Solution

  • This should answer your questions: http://msdn.microsoft.com/en-us/library/bb166192.aspx (Template Directory Description (.Vsdir) Files)