我正在编写自己的自定义项目模板以在 Visual Studio 中使用。一切都很好,除了我需要找到一种方法让模板中的一个文件依赖于另一个。
在 csproj 文件中,它看起来像这样
<Compile Include="Class1.cs">
<DependentUpon>Class1.xml</DependentUpon>
</Compile>
有人知道我将如何在 vstemplate 文件中定义它吗?
谢谢
我正在编写自己的自定义项目模板以在 Visual Studio 中使用。一切都很好,除了我需要找到一种方法让模板中的一个文件依赖于另一个。
在 csproj 文件中,它看起来像这样
<Compile Include="Class1.cs">
<DependentUpon>Class1.xml</DependentUpon>
</Compile>
有人知道我将如何在 vstemplate 文件中定义它吗?
谢谢
<ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs" ReplaceParameters="true">Test.cs</ProjectItem>
<ProjectItem SubType="Code" TargetFileName="$fileinputname$.cs\$fileinputname$Dependent.cs" ReplaceParameters="true">TestDependent.cs</ProjectItem>
不确定对于非托管文件类型是否会自动发生这种情况(即 VS 不知道的文件类型,比如你的文件类型)......
一个技巧是像这样使用 WizardExtensions (谷歌关于编写基本向导的例子):
或者
希望这可以帮助...