如何在 VS2015 中使用 T4? (Microsoft.TextTemplating.targets 未找到文件)

How to use T4 with VS2015? (Microsoft.TextTemplating.targets file not found)

我第一次尝试用 Visual Studio 2015 打开我的一个项目,它说:

The importede project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TextTemplating\Microsoft.TextTemplating.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

文件确实不存在于磁盘上。我必须安装哪种 SDK 才能在 VS 2015 中使用文本模板?

我自己找到了答案。必须安装“Modeling SDK for Visual Studio", available here.