I am trying to use such a simple scheme in my project:
Item.cs → contains a C # partial class with simple entity properties. He also set the "Custom Tool: T4ScriptFileGenerator" property, so he attaches the "grouped" Item.tt file to it. On its way, Item.generated.cs is generated, grouped by Item.tt. Thus, this leads to a grouped tree in the solution explorer:
Item.cs ˪Item.tt ˪Item.generated.cs
Below you can see how it looks in the .csproj file.
The entire project is connected to the TFS 2010 workspace.
The problem is this:
When I edit Item.cs, the t4 engine recreates the Item.generated.cs file, but does not check it from tfs. It automatically checks only the first two levels of "grouped" files - Item.cs and its dependent Item.tt. Item.generated.cs is updated, but just overwritten without verification.
If I edit the Item.tt file or just click “Run the special tool” on it, two files are uploaded again: Item.tt and its dependent Item.generated.cs This is strange because it forces us to manually “run the custom tool” in each file * .tt after editing entity class files so that nothing is lost in TFS.
Q: Is there a way to get it to check the entire DependentUpon file tree when editing the main Item.cs?
Here's what it looks like in a .csproj source:
<Compile Include="Entities\Item.cs"> <Generator>T4ScriptFileGenerator</Generator> <LastGenOutput>Item.tt</LastGenOutput> </Compile> <None Include="Entities\Item.tt"> <Generator>TextTemplatingFileGenerator</Generator> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Item.cs</DependentUpon> <LastGenOutput>Item.codegen.cs</LastGenOutput> </None> <Compile Include="Entities\Item.codegen.cs"> <AutoGen>True</AutoGen> <DesignTime>True</DesignTime> <DependentUpon>Item.tt</DependentUpon> </Compile>
source share