Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Maximize Your Productivity with Project Item Templates : Page 4

Create your own Windows Forms, Web Forms, or class templates to reuse code and maximize your productivity in Visual Studio 2003.


advertisement
Testing the Template
At this point, try your template and ensure that it appears appropriately in the Add New Item dialog box. Open any exiting project or create a new project, right-click on the project, and select Add then choose Add Class from the context menu. Give the class a name and click OK. If all is well, Visual Studio will create a class file using your template. If your template does not appear in the Add New Item dialog box, or if you receive an error when selecting the template from the Add New Item dialog box, recheck your files as described below.

In VB:

  1. Ensure that there is a subdirectory under \Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards named using your defined template wizard name (BOTemplateWiz in this example).
  2. Ensure that the BOTemplateWiz subdirectory contains the Scripts and Templates folders like all of the other wizard directories.
  3. Ensure that under the Templates\1033 folder you have the actual template file (BOTemplate.vb in this example). This file should contain the code, comments, and ToDo notes that you want in your template.
  4. Ensure that under the Scripts\1033 folder you have the default.js file similar to the other wizards. The only change you should have made to this file is setting the strTemplateFile variable to your template file name.
  5. Ensure that you have a wizard file (BOTemplateWiz.vsz in this example) in the \Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBProjectItems directory. The only change you should have made to this file is updating the WIZARD_NAME to the name of your subdirectory from step #1.
  6. Ensure that you added the appropriate line to the \Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBProjectItems\Local Project Items\LocalProjectItems.vsdir file. The first field in this line should contain the name of the wizard file (BOTemplateWiz.vsz in this example).
In C#:

  1. Ensure that there is a subdirectory under \Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards named using your defined template wizard name (BOTemplateWiz in this example).
  2. Ensure that the BOTemplateWiz subdirectory contains the Scripts and Templates folders like all of the other wizard directories.
  3. Ensure that under the Templates\1033 folder you have the actual template file (BOTemplate.cs in this example). This file should contain the code, comments, and ToDo notes that you want in your template.
  4. Ensure that under the Templates\1033 folder you have a Templates.inf file that contains only the name of your template file (BOTemplate.cs in this example).
  5. Ensure that under the Scripts\1033 folder you have the default.js file similar to the other wizards. You should not need to change this file.
  6. Ensure that you have a wizard file (BOTemplateWiz.vsz in this example) in the \Program Files\Microsoft Visual Studio .NET 2003\VC#\CSharpProjectItems directory. The only change you should have made to this file is updating the WIZARD_NAME to the name of your subdirectory from step #1.
  7. Ensure that you added the appropriate line to the \Program Files\Microsoft Visual Studio .NET 2003\VC#\CsharpProjectItems \LocalProjectItems\LocalProjectItems.vsdir file. The first field in this line should contain the name of the wizard file (BOTemplateWiz.vsz in this example).
Take special care in ensuring that you have the correct names in all of the correct places.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date