T4 Template in VS 2015
Asked Answered
B

2

5

How do I get T4 Template support in Visual Studio 2015?
In VS 2015 the file property does not allow to specify the *tt file to be marked and allow to run from context menu.
I am using VS 2015 CTP6.

Booster answered 2/3, 2015 at 5:40 Comment(6)
it's CTP. Maybe they didn't get round to it yet? Use 2013 insteadFlyover
I can't seem to get it to show up in an ASP.NET 5 project either. (I'm running CTP6)Great
The Custom Tool property is not there.Topmast
It's STILL not there as far as I can tell....WTF?Shockheaded
Nevermind, it just doesn't work in shared projects...BONEDShockheaded
I've got this dumb problem too. I only need it for the simplest code generation but .tt files do nothing. Dammit.Zarf
A
2

Tried VS2015 Ultimate CTP6 and T4 support is in (as well as debugging T4 which is nice). One specify TextTemplatingFileGenerator as Custom tool as before and when saving the .TT file it is executed.

There's a context menu called "Run Custom Tool" which seems to execute the .TT file as well.

Aegisthus answered 3/3, 2015 at 17:8 Comment(1)
The Custom Tool property is not there, there is no 'Run Custom Tool' option either.Topmast
T
0

As far as I can tell, the properties in the csproj have to be correct for the t4 template debug options to show up. This works for me in vs 2015 update 1

There's two sections, the template and the output file.

<Content Include="Entities\DataGenerator.tt">
  <Generator>TextTemplatingFileGenerator</Generator>
  <LastGenOutput>DataGenerator.cs</LastGenOutput>
</Content>

<Compile Include="Entities\DataGenerator.cs">
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
  <DependentUpon>DataGenerator.tt</DependentUpon>
</Compile>

*Note that TextTemplatingFileGenerator is case sensitive.

Totter answered 22/2, 2016 at 15:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.