Took a while to unravel, but I have a working TextTransform.exe
! Here are the steps I found necessary (note: only tested with VS2015 and .NET 4.6.1):
First, on the build machine, copy all of the following files into C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\14.0
(or wherever you want the tool to end up):
C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\14.0\TextTransform.exe
C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.14.0\v4.0_14.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.14.0.dll
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.TextTemplating.Interfaces.11.0.dll
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.TextTemplating.Interfaces.14.0.dll
C:\Program Files (x86)\MsBuild\14.0\Bin\Microsoft.CodeAnalysis.dll
C:\Program Files (x86)\MsBuild\14.0\Bin\Microsoft.CodeAnalysis.CSharp.dll
C:\Program Files (x86)\MsBuild\14.0\Bin\Microsoft.CodeAnalysis.VisualBasic.dll
C:\Program Files (x86)\MsBuild\14.0\Bin\System.Reflection.Metadata.dll
If your T4 templates contain C#/VB code, the Microsoft.VisualStudio.TextTemplating.Interfaces.10.0
and Microsoft.VisualStudio.TextTemplating.Interfaces.11.0
assemblies will be resolved from a dynamically-created app-domain, and will not be found next to TextTransform.exe
. They must be registered in the GAC instead.
From an Administrator command prompt, execute:
gacutil -i Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll
gacutil -i Microsoft.VisualStudio.TextTemplating.Interfaces.11.0.dll
Note: gacutil
is typically found in C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools
.
Create a TextTransform.exe.config
file next to TextTransform.exe
with binding redirects (may or may not be necessary depending on your .NET version):
<?xml version ="1.0"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="1.1.37.0" newVersion="1.1.36.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
When TextTransform.exe
first starts, it checks for a folder at %VS140COMNTOOLS%\..\IDE\PrivateAssemblies
and throws an exception if it does not exist.
So, either create a %VS140COMNTOOLS%
environment variable that points to a path accordingly, or create an empty ..\IDE\PrivateAssemblies
relative to the
working directory where TextTransform.exe
will be called from.