- Go to the right folder on your local machine.
- x64: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
- x86: C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033
- In that folder you will see the Class.zip file. If you open the class file directly from the zip, you can see the default class template of Visual Studio 2010. In my case, I want to add some default stuff like regions and constructors.
- Save the class file. It could be that you get a question that the zip file has changed and want to be reloaded. Click in that case “Yes”.
- Now, if you open VS2010, you won’t get the new class template yet. This is because the class template is not yet available in VS2010. VS2010 uses an ItemTemplatesCache directory to store the active templates. You need to override the already active template. This sounds very difficult but is very easy to do. Open your Visual Studio command prompt from the visual studio installation folder in your start menu.
(You maybe need to open it as Administrator)
Fill in this comamnd: “devenv.exe /installvstemplates”
The strange part here is that you won’t get any confirmation about the success of the installation. This could take a while because when I looked several times in visual studio, I still got the old template. After a few minuts, the new template was suddenly there.
- It is better to close all your Visual Studio instances. before you follow these steps above.
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
public class $safeitemrootname$
#region Private Fields
#region Private Properties
#region Public Properties
/// The default Constructor
#region Private Methods
#region Public Methods