PROejct模板中“ProjectTemplate.csproj”和“ProjectTemplate1.vstemplate”的意义是什么?

时间:2012-06-17 03:50:02

标签: .net templates

标题是问题。我很想知道那些的重要性。根据我的理解,.csproject包含将被编译的条目(例如,类,引用)

<ItemGroup>
        <Reference Include="System"/>
        $if$ ($targetframeworkversion$ >= 3.5)
        <Reference Include="System.Core"/>
        <Reference Include="System.Xml.Linq"/>
        <Reference Include="System.Data.DataSetExtensions"/>
        $endif$
        $if$ ($targetframeworkversion$ >= 4.0)
        <Reference Include="Microsoft.CSharp"/>
        $endif$
        <Reference Include="System.Data"/>
        <Reference Include="System.Xml"/>
    </ItemGroup>
    <ItemGroup>
        <Compile Include="Class1.cs" />

        <Compile Include="Properties\AssemblyInfo.cs" />
    </ItemGroup>

和ProjectTemplate1.vstemplate是那些链接。这是正确的吗?

1 个答案:

答案 0 :(得分:0)

.vstemplate定义项目模板。它通常包含一个模板化的.csproj(或几个)定义,当您从该模板实例化项目时,它将被创建。

因此,在您给出的示例中,您的.vstemplate可能包含类似

的内容
<VSTemplate Type="Project" Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
    <TemplateContent>
        <Project File="ProjectTemplate.csproj">
            <ProjectItem>Class1.cs</ProjectItem>
            <ProjectItem>Properties\AssemblyInfo.cs</ProjectItem>
        </Project>
    </TemplateContent>
</VSTemplate>
相关问题