Sunday, August 31, 2008

changing the class item template in VS2008

It's been bugging me for too long, every bloody time I go new -> class in VS2008,
I get a class that is not set to public. I usually don't realize until I try to use the class at some later time.

Today I finally snapped and fixed it.

To change the template that is used to create new empty classes in VS2008,
- Go to 
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
- unzip the class.zip.
- change the class.cs file
- zip it back up and replace the original .zip file.

In yo face VS2008 default settings!!

7 comments:

Erlend Oftedal said...

Nice. By editing the SimpleUnitTest template I can also get rid of all the crappy outcommented stuff.

Unknown said...

As a note there seems to be a folder called "ItemTemplatesCache" (C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplatesCache\CSharp\Code\1033) in which you also need to update class.zip for it to work, but I'm sure there's another way of doing this.

For those using the express editions, the files can be located here:

[drive]:\[programs directory]\Microsoft Visual Web Developer 2008 Express\Common7\IDE\[express edition]\ItemTemplates\1033

[drive]:\[programs directory]\Microsoft Visual Web Developer 2008 Express\Common7\IDE\[express edition]\ItemTemplatesCache\1033

You can replace [express edition] with VCSExpress (Visual C# Express Edition), VWDExpress (Visual Web Developer Express) and so forth. The paths might also depend on which Edition you installed first, but you get the point.

Harry said...

I changed all class1.cs to our template, but when I use the toolbox to add a class unto the class-diagram, our template is not used. Do you know were this template can be found?

HaseebUddin said...

Hire Our SEO Expert to grow your search engine ranking, traffic, & backlinks in Google, Bing, Yahoo search results Affordable SEO Services

FaizAlam said...

Get some of the best and amazing


youtube tv coupon code

Jockrs said...

Its very informative blog its very helpful for learning and written skills.
visit my web site : https://jockrs.com/

williumson said...

Thank you for sharing this its very important for the learners. Black Friday is celebrated every year after the thanksgiving Holidays in USA. Many stores offer black Friday specials and deal in all categories to provide the best saving opportunities. Click here: Black Friday Deals