T4模板错误

时间:2009-08-21 12:20:30

标签: c# visual-studio visual-studio-2008 t4

错误是:

Error   48  A processor named 'PropertyProcessor' could not be found for the directive named 'property'. The transformation will not be run.  The following Exception was thrown:
System.IO.FileNotFoundException: Failed to resolve type for directive processor PropertyProcessor.
   at Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolveDirectiveProcessor(String processorName)
   at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, List`1 directivesToBeProcessed)   Config.tt   2   4   

T4模板是:

<#@ template language="C#" #>
<#@ property name="serverName" processor="PropertyProcessor" type="System.String" #>

using System;   

我该如何解决此错误?这是什么意思?

1 个答案:

答案 0 :(得分:6)

&lt;#@ property#&gt;是一个自定义指令。 Visual Studio中的T4主机不支持它。您可以使用GAX主机或提供PropertyProcessor的替代实现,例如Clarius Consulting的T4编辑器中包含的实现。更多here