Yes, you can. This MSDN article http://msdn.microsoft.com/en-us/library/s365byhx.aspx has links to several approaches to achieve this.
I think that the easiest way is to create a file with the desired template, substitute parameters and export the template. In your example, create a new class with an existing template
namespace Foo { public class Bar { } }
Translate the variable parts of this. those. namespace name 'Foo' and class name 'Bar'
namespace $rootnamespace$ { public class $safeitemrootname$ { } }
Save changes
- Now you can go to File → Export Template. Select an item template (click Next)
- Select the file created for this example (click "Next")
- Select any links to the objects that you want to add to the project. In that
case no (click next) - Enter a name for the template (i.e. PublicClass). This is what the file will be called in the dialog box of the new file. Also, the default file will be called upon creation
This will create a zip file in {userpath} / My Documents / Visual Studio 2010 / My Exported Templates. You do not need to run an administrator or run any other tools. VS will automatically get it out of this way.
I understand that this does not replace the existing option. If you want to do this, I would use the same process using the same element name as the default element name. In this case, the class. I would use the registration path and process defined by @James Hill
btlog source share