【发布时间】:2017-07-28 11:17:44
【问题描述】:
在 Visual Studio 2015 中,我使用 NuGet 包 Unofficial.Microsoft.VisualStudio.TextTemplating.14.0.0,它允许我在构建项目时直接从 MSBuild 转换 T4 模板。
然而,在 Visual Studio 2017 RTM 中,这会通过以下消息中断构建:
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'
这是由此包中的文件Unofficial.Microsoft.VisualStudio.TextTemplating.targets(396,5) 引发的。
我的猜测是,由于环境不匹配,试图从 VS 2017 构建中使用这些目标,但我不知道如何追踪确切的问题。我还没有看到 v15 的更新包。
如何从适用于 VS 2017 的 MSBuild 进行 T4 转换?是否会在某个时候使用来自 NuGet 的新包,还是不再支持?
【问题讨论】:
标签: c# visual-studio msbuild t4 visual-studio-2017