原文地址:http://www.codeproject.com/dotnet/AddingTemplatesAddBox.asp
英文水平有限我就不翻译了,他主要的操作步骤如下
1、用记事本打开“Microsoft Visual Studio .NET 2003\VC#\CSharpProjectItems\LocalProjectItems\Code”文件夹下的code.vsdir文件找到下面的一行:
..\..\CSharpAddClassWiz.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2245|10|#2262|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4515|0|Class.cs
下面建立新的一行,将下面的语句复制过去
..\..\CSharpAddInterfaceWiz.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|Interface|10|An empty interface declaration|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4515|0|Interface.cs
另:如果你看了英文文章的话细心的你可能会发现我的GUID与其不一样,是这样的我使用的是中文企业版的VS2003如果你用的别的版本的以你的里面的为主。如果你与我一样的话,可以直接复制。
2、用记事本打开“Microsoft Visual Studio .NET 2003\VC#\CSharpProjectItems\LocalProjectItems\”文件夹下的LocalProjectItems.vsdir文件找到下面的一行:
..\CSharpAddClassWiz.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|#2245|20|#2262|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4515|0|Class.cs
再其下面新建立一行,将下面的语句复制过去
..\CSharpAddInterfaceWiz.vsz|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|Interface|20|An empty interface declaration|{FAE04EC1-301F-11d3-BF4B-00C04F79EFBC}|4515|0|Interface.cs
注意:上面需要复制的字符串必须在一行内,不能分多行处理!!!
3、在Microsoft Visual Studio .NET 2003\VC#\CSharpProjectItems 文件夹下用记事本创建一个CSharpAddInterfaceWiz.vsz的文件,将下面的代码复制进去,不要改动:
WIZARD 7.0
Wizard=VsWizard.VsWizardEngine.7.1
Param="WIZARD_NAME = CSharpAddInterfaceWiz"
Param="WIZARD_UI = FALSE"
Param="PROJECT_TYPE = CSPROJ"
4、在\Microsoft Visual Studio .NET\VC#\VC#Wizards文件下建立一个新的文件夹取名为CSharpAddInterfaceWiz,然后将同文件下的CSharpAddClassWiz内的所有文件拷贝至CSharpAddInterfaceWiz下。打g开\CSharpAddInterfaceWiz\Templates\2052文件下的NEWCLASS.CS文件,用下面的代码替换掉原代码
![None.gif](/Images/OutliningIndicators/None.gif)
2
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
3
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
4
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
5
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
10
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
11
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
12
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
13
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
14
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
15
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
16
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
18
![None.gif](/Images/OutliningIndicators/None.gif)
19
![None.gif](/Images/OutliningIndicators/None.gif)
关闭后将文件名改为:NewInterface.cs
修改下面的Templates.inf文件,将其内容改为NewInterface.cs
至此全部修改完毕,您可以打开一个新的工程,然后选择添加新项,这时会在里面出现一个INTERFACE选项,点击后即可生成相应的代码.