2014-01-13 32 views
4

我想在T4模板中使用我自己的項目中的類型,所以我想使用VolatileAssembly指令,因此我不必重新啓動Visual Studio:無法解析指令處理器的類型T4Toolbox.VolatileAssemblyProcessor

<#@ VolatileAssembly processor="T4Toolbox.VolatileAssemblyProcessor" name="C:\Josh\Archimetrics\Archimetrics.Consulting\Suntex\SuntexFirstInMathTools\bin\Debug\SuntexFirstInMathTools.exe" #> 

但我不斷收到以下錯誤:

A processor named 'T4Toolbox.VolatileAssemblyProcessor' could not be found for the directive named 'VolatileAssembly'. The transformation will not be run. 
The following Exception was thrown: 
System.IO.FileNotFoundException: Failed to resolve type for directive processor 
T4Toolbox.VolatileAssemblyProcessor. 
at Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService.ResolveDirectiveProcessor(String processorName) 
at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, IEnumerable`1 directivesToBeProcessed) 

我已經安裝了T4工具箱並重新啓動,但由於某種原因,將無法識別VolatileAssemblyProcessor。

我該如何解決這個問題?

回答

1

They are also harder to use than templates because code they generate is invisible to you by default. In addition, the VolatileAssembly is no longer necessary because in Visual Studio 2012 the assembly directive shadow-copies the assembly files before loading them - the developers page -

所以我認爲你不需要這個指令了。只有使用<#@ assembly name="YourPathOrName" #>才能解決您的問題。