.tt files only run VS automatically when saved. You can install AutoT4 so that they run before / after the build. (Keep in mind that at the moment there is a restriction with new .csproj files - the parameters are not displayed for them in the properties window.)
If you converted from the old project.json / .xproj , you may need to explicitly add the template to the project:
<ItemGroup> <None Update="Foo.tt"> <Generator>TextTemplatingFileGenerator</Generator> <LastGenOutput>Foo.cs</LastGenOutput> </None> <Compile Update="Foo.cs"> <DesignTime>True</DesignTime> <AutoGen>True</AutoGen> <DependentUpon>Foo.tt</DependentUpon> </Compile> </ItemGroup>
GitHub related issue
Edit
As mentioned in the comments below, you can do this quickly and simply by excluding and then including the template in your project.
source share