In Visual Studio 2015, I'm using the NuGet package Unofficial.Microsoft.VisualStudio.TextTemplating.14.0.0
which allows me to transform T4 templates directly from MSBuild, whenever a project is built.
In Visual Studio 2017 RTM however, this breaks the build with the following messages:
An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.CodeAnalysis, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
This is raised by the file Unofficial.Microsoft.VisualStudio.TextTemplating.targets(396,5)
which is in this package.
My guess is that the error comes from trying to use these targets from a VS 2017 build due to mismatched environments, but I don't know how to trace the exact issue. There is no updated package yet for v15 that I can see.
How can I do T4 transforms from MSBuild that will work for VS 2017? Will there be a new package from NuGet to use at some point or is this not going to be supported anymore?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…