【发布时间】:2016-08-05 15:50:51
【问题描述】:
我正在使用 Visual Studio 2015 更新 3。我尝试将 TextTransform.exe 与 dp 标志一起使用,但出现此错误:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude(1,4): error : A processor named 'T4VSHost' could not be found for the directive named 'CleanupBehavior'. The transformation will not be run. The following Exception was thrown:
System.IO.FileNotFoundException: Failed to load directive processor T4VSHost. ---> System.IndexOutOfRangeException: L'index se trouve en dehors des limites du tableau.
à Microsoft.VisualStudio.TextTemplating.CommandLine.DirectiveProcessorConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
à Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost.ResolveDirectiveProcessor(String processorName)
à Microsoft.VisualStudio.TextTemplating.CommandLine.CommandLineHost.ResolveDirectiveProcessor(String processorName)
à Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, IEnumerable`1 directivesToBeProcessed)
产生错误的行:
texttransform -out "P:\<Path to project>\Model.cs" -I "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes" -dp T4VSHost"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Microsoft.Data.Entity.Design.dll" "P:\<Path to project>\Model.tt"
我查找的其他问题:
- Get Visual Studio to run a T4 Template on every build(我以接受的答案为基础)
- Processor Named ‘T4VSHost’ Could Not Be Found For The Directive Named ‘CleanupBehavior’
- Generating T4 on Build using VS 2012(不如批处理文件灵活)
目前我所知道的是所有路径都是正确的,并且我的注册表中 T4VSHost 的定义是正确的。
限制:
- 我无法修改/移动 .tt 文件
- 我无法移动程序集文件或 ttinclude 文件(尽管我尝试过)
我非常希望避免修改 EF.CS.ttinclude 文件。什么可能导致此问题?
【问题讨论】:
标签: visual-studio-2015 template-engine t4