在Visual Studio 2015中,我使用的NuGet包Unofficial.Microsoft.VisualStudio.TextTemplating.14.0.0
允许我在每次构建项目时直接从MSBuild转换T4模板。MSBuild支持Visual Studio 2017 RTM中的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包,我可以看到。
我该怎么做T4转换从MSBuild将适用于VS 2017?是否会有NuGet的新软件包在某个时候使用或者不再支持?
很高兴知道您已解决此问题。请标记您的答案,这对其他有相同问题的社区是有好处的。 –
这帮了我很大的忙(谢谢!),但我想指出它只适用于.NET Framework项目,而不是.NET标准项目,至少现在只是FYI。 –
@JorgeYanesDiez,可能你需要' 而不是'Microsoft.CSharp.targets'。在http://webcache.googleusercontent.com/search?q=cache:http://www.natemcmaster.com/blog/2017/03/09/vs2015-to-vs2017-upgrade/&gws_rd上查看我的评论和OP的回复= cr&ei = yo9TWbKIPMS0aY_zqJAB –