RCI*_*CIX 38 installation templates visual-studio-2010 visual-studio
我正在使用F#,我发现可用模板有点稀疏,我喜欢,我想做更多.我该怎么做呢?另外,在我制作这些模板后,我将如何安装这些模板?
Bre*_*yan 28
在Visual Studio的路径中,您将找到默认模板,这些是一组zip文件,可以扩展到模板cach中.
它们存储在
%VSInstallDir%\Common7\IDE\ItemTemplates\
%VSInstallDir%\Common7\IDE\ProjectTemplates\
提取有问题的{{.zip}}并使用修改后的内容重新压缩将更新模板.您还可以将这些文件复制到其中一个相应的模板文件夹中%USERPROFILE%\Documents\Visual Studio 2010
.
有关构建模板的信息,请查看MSDN 上的Visual Studio模板.
然后,您需要告诉VS重建缓存.
devenv /installvstemplates
您还可以使用文件菜单中的"导出模板..."向导,但导出的模板会丢失原始内容(如if
语句).
我遇到了这个和多个自定义模板的问题.每个模板(例如vstemplate + cs文件)都应该在它自己的zip文件中.如果你把几个放在同一个拉链上,它就不会拿起任何一个拉链.
我还发现,如果你把它们放入:
$My Documents$\Visual Studio 2010\Templates\ItemTemplates
然后你不需要运行Brett提到的命令(devenv/installvstemplates).大概这只是在修改安装文件夹中的现有文件时.
这是我用来敲击NUnit测试的示例:
代码文件(带.cs /相关扩展名):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
namespace $rootnamespace$
{
[TestFixture, Category("issue")]
public class $safeitemname$
{
[SetUp]
public void Setup()
{
}
[Test]
public void Test()
{
}
}
}
Run Code Online (Sandbox Code Playgroud)
模板文件(扩展名为.vstemplate):
<VSTemplate Version="3.0.0" Type="Item"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" >
<TemplateData>
<DefaultName>ATest.cs</DefaultName>
<Name>NUnit test</Name>
<Description>
with [TestFixture] attribute set on class and one empty method
called Test that has [Test] attribute
</Description>
<ProjectType>CSharp</ProjectType>
<SortOrder>10</SortOrder>
<Icon>someIcon.ico</Icon>
</TemplateData>
<TemplateContent>
<References />
<ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs"
ReplaceParameters="true">TheCodeFile.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
91736 次 |
最近记录: |