Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 10th, 2006, 10:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default Custom Default Class Template

Does anybody know how to create a custom C# template that could be used to create the default Class1.cs (or Program.cs in VS2K5) file thats generated when you start a new C# project?

Thanks,

Bob

 
Old November 11th, 2006, 07:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Bob,

You have two options:

1. You can create a custom item template. Whenever you add a new class yourself, you can choose that template.

2. You can create a custom project template with the required class(es). Whenever you create a new project, you can choose that template.

In both cases, design your class or project the way you want it to look like, including references, namespaces, imports etc. Then choose File | Export template. You'll get a wizard that guides you through creating one of the two template types. When the wizard is ready, you'll have a .zip file with all the required files that you can customize further.

If you search Google for some of the replacement terms in the template files (like $safeitemname$) you'll find some interesting background articles about customizing your item and project templates, like this one:

http://msdn2.microsoft.com/en-us/library/eehb4faa(VS.80).aspx

Additionally, you should also be able to customize the default templates located here: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
 
Old November 11th, 2006, 11:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Thanks much Imar. I'm dashing out to do some serious fishin', but I'll give it a whirl when I get back. Have a great day!

Bob

 
Old November 11th, 2006, 03:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You're welcome...

Good luck!

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Paper Size (custom also) to default Printer gaurikhot .NET Framework 2.0 2 December 6th, 2008 01:50 AM
Custom Process Template and Policies peterltv BOOK: Professional Team Foundation Server ISBN: 0-471-91930-6 0 January 11th, 2007 06:20 AM
How to custom-define the default background colour ms_priya Java GUI 1 January 10th, 2006 05:28 PM
Class library template does not exist - normal? redbaiter BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 3 April 1st, 2005 05:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.