我在一個項目中創建一個自定義的T4指令處理器,現在我想使用的處理器在另一個項目T4模板,但我收到以下錯誤:如何在T4模板中使用自定義指令?
The type '
MyNamespace.MyCustomDirectiveProcessor
' of the directive processor named 'MyCustomDirectiveProcessor
' does not derive fromMicrosoft.VisualStudio.TextTemplating.DirectiveProcessor
. The transformation will not be run.
我的指令處理器類像這樣定義:
using Microsoft.VisualStudio.TextTemplating;
namespace MyNamespace
{
public class MyCustomDirectiveProcessor : DirectiveProcessor
{
// etc.
}
}
我需要做些什麼來使定製指令工作?我遵循this documentation中的指導原則將指令處理器添加到註冊表中。我在項目的後期構建步驟中這樣做,我已經定義了我的指令處理器類,並且確保項目已構建並添加了註冊表項。