Plunging into .NET Development

Weblog Pieter Gheysens
Microsoft .NET Development - C# - Enterprise Library - Visual Studio 2005 Team System - Compuware DevPartner - ...

Thursday, November 13

Enterprise Class Library Project Template

It's really a shame that I didn't use the Export Template feature of Visual Studio up till now.

Lately, I got a bit frustrated by modifying each time the standard Class Library Project in my development projects. Here are the project settings I always want to enforce when creating a new Enterprise Class Library Project (note that these settings should be set for the Debug and Release configuration):
  • Remove the default Class1.cs file

  • Treat all warnings as errors during compilation

  • Generate XML documentation file

  • Enable Code Analysis during compilation and treat warnings as errors

A side effect of enabling all Code Analysis rules will be that the project won't compile anymore because rule CA2210 will require a strong name for the output assembly. A possible solution for this is to also add the default strong name key file to the project before exporting the template. After all, enabling all Code Analysis rules from the start is really a good thing to do in your projects! Have you ever tried enforcing this in the middle of a project? There's a bunch to learn from the Code Analysis rules for each developer!

Anyway, after you have chosen the project settings you want to activate on an empty Class Library Project, you only have to follow the Export Template ... wizard to create a reusable Enterprise Class Library Project :
  • Choose Project template for the type of template you would like to create

  • Choose a Template Icon, a Template name and and a Template description

  • Finishing the wizard will result in your customized Project Template that will be available in the new Project dialog.

Taking it one step further, you can also share your custom project templates with your team if you copy the resulting zip files to a shared location and reference that shared location in the User project templates location.



Post a Comment

Links to this post:

Create a Link

<< Home