using System;
namespace MyNameSpace
{
class MyClass
{
}
}
Here is what I want it to look like:
using System;
namespace MyNameSpace
{
public class MyClass
{
#region << Constant Variables >>
#endregion
#region << Private Variables >>
#endregion
#region << Public Variables >>
#endregion
#region << Properties >>
#endregion
#region << Constructors >>
/// <summary>
/// Default constructor.
/// </summary>
public $safeitemrootname$()
{
}
#endregion
#region << Private Methods >>
#endregion
#region << Public Methods >>
#endregion
#endregion
#region << Private Variables >>
#endregion
#region << Public Variables >>
#endregion
#region << Properties >>
#endregion
#region << Constructors >>
/// <summary>
/// Default constructor.
/// </summary>
public $safeitemrootname$()
{
}
#endregion
#region << Private Methods >>
#endregion
#region << Public Methods >>
#endregion
}
}
So making this change is easy to do. All you have to do is edit a text file that is compressed.
So making this change is easy to do. All you have to do is edit a text file that is compressed.
Copy the zip file, file located here to the desktop:
Visual Studio 2008
For 64 bit:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
For 32 bit:
For 32 bit:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
Visual Studio 2010
For 64 bit:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
For 32 bit:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
Extract the zip file.
Using a text editor, open the Class.cs file.
The file will have the following text:
using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
namespace $rootnamespace$
{
class $safeitemrootname$
{
}
}
Change it to have this text:
using System;
using System.Collections.Generic;
$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;
$endif$using System.Text;
namespace $rootnamespace$
{
public class $safeitemrootname$
{
#region << Constant Variables >>
#endregion
#region << Private Variables >>
#endregion
#region << Public Variables >>
#endregion
#region << Properties >>
#endregion
#region << Constructors >>
/// <summary>
/// Default constructor.
/// </summary>
public $safeitemrootname$()
{
}
#endregion
#region << Private Methods >>
#endregion
#region << Public Methods >>
#endregion
#endregion
#region << Private Variables >>
#endregion
#region << Public Variables >>
#endregion
#region << Properties >>
#endregion
#region << Constructors >>
/// <summary>
/// Default constructor.
/// </summary>
public $safeitemrootname$()
{
}
#endregion
#region << Private Methods >>
#endregion
#region << Public Methods >>
#endregion
}
}
Save the file.
Rebuild the zip file with the new Class.cs. Be careful to build the zip file correctly.
Copy the new zip file back here and overwrite the existing one:
For 64 bit:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
For 32 bit:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
Visual Studio 2010
For 64 bit:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
For 32 bit:
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class.zip
Now, you have to rebuild the template classes. To do this:
Open a command prompt as Administrator.
Change to the appropriate directory:
cd C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\
32-bit
cd C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\
Visual Studio 2010
cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\
32-bit
cd C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\
Run this command:
devenv.exe /installvstemplates
Now any new class you create will have your new format.
No comments:
Post a Comment