I have been using your ttinclude to great success.
I have modified the Manager.Create method to support generating templates build time:
public static Manager Create(ITextTemplatingEngineHost host, StringBuilder template) {
if((host as IServiceProvider) != null)
{
var hostServiceProvider = host as IServiceProvider;
if((EnvDTE.DTE) hostServiceProvider.GetService(typeof(EnvDTE.DTE)) != null)
{
return new VSManager(host, template);
}
}
return new Manager(host, template);
}
This way you don't need Visual Studio to build the T4 templates and MSBuild can do it as a build step.
I have added these lines to my csproj to run the textgeneration as a build step:
<PropertyGroup>
<!-- Get the Visual Studio version โ defaults to 10: -->
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<!-- Keep the next element all on one line: -->
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup>
<TransformOnBuild>true</TransformOnBuild>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TextTemplating\Microsoft.TextTemplating.targets" />
This worked fine until updating to Update 2. But now building the project results in this.
Warning: Compiling transformation: Assuming assembly reference 'mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' used by 'EnvDTE' matches identity 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' of 'mscorlib', you may need to supply runtime policy. Line=1, Column=1 (0, 0)
I can still ctrl+s the tt file and it generates the output, but I want generation to happen on my build servers using msbuild.
There are somewhat similar reports on the internet, but not sure if this is related: http://stackoverflow.com/questions/35412460/compiling-transformation-the-type-object-is-defined-in-an-assembly-that-is-no
Can you help me figure out why does it want a different version of mscorlib and how can I feed the version it wants to the ttinclude?