Reputation: 109
I have multiple tt files in my project file. Therefore, many entries are created for each file as follows.
<ItemGroup>
<Compile Update="Sample.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Sample.tt</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Sample.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Sample.cs</LastGenOutput>
</None>
</ItemGroup>
I want to prevent making this entry for every tt file.
The following statements were made using wildcards.
<ItemGroup>
<Compile Update="**/*.tt.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<None Update="**/*.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>%(Filename).tt.cs</LastGenOutput>
</None>
</ItemGroup>
The following settings are used in the tt file.
<#@ output extension="tt.cs" #>
T4 works, but when I save the tt file, the following entry is added to csproj.
<ItemGroup>
<Compile Update="Sample.tt.cs">
<DesignTime>True</DesignTime>
</Compile>
</ItemGroup>
How can I prevent entries from being added?
Upvotes: 0
Views: 200
Reputation: 2299
We can see the description of Update from this page
Enables you to modify metadata of an item; typically used to override the default metadata of specific items after a group of items is intially specified (such as with a wildcard).
Update overrides Compile when save the tt file, so this code will be added to scproj. This doesn't seem to prevent.
<ItemGroup>
<Compile Update="Sample.tt.cs">
<DesignTime>True</DesignTime>
</Compile>
</ItemGroup>
Upvotes: 1