我正在编写一个自定义插件来自定义 SpecFlow 生成的自动生成的代码文件。
构建解决方案并将其放入 SpecFlow 测试项目的“lib”文件夹后。在保存 SpecFlow 特征文件时,我得到了
Specflow plugin : Generation error: Missing [assembly:GeneratorPlugin] attribute in 'path to dll'
即使我在插件 Assembly 中标记了它
[assembly: GeneratorPluginAttribute(typeof(CustomGeneratorPlugin))]
使用反射/ self 测试我可以自己加载程序集并解析属性
代码在这里 -- https://github.com/chrismckelt/SpecFlowCustomPlugin
任何想法是什么造成的?谢谢
最佳答案
通过将以下“路径”属性添加到生成器 SpecFlow 配置部分来解决
<generator path=".\lib"
完整配置
<specFlow>
<generator allowDebugGeneratedFiles="false" allowRowTests="true" generateAsyncTests="false" path=".\lib" />
<runtime stopAtFirstError="false" missingOrPendingStepsOutcome="Ignore" />
<trace traceSuccessfulSteps="true" traceTimings="false" minTracedDuration="0:0:0.1" stepDefinitionSkeletonStyle="RegexAttribute" />
<plugins>
<add name="McKeltCustom" path=".\lib" type="GeneratorAndRuntime" />
</plugins>
<stepAssemblies>
<stepAssembly assembly="SpecFlow.Assist.Dynamic" />
</stepAssemblies>
</specFlow>
关于c# - Specflow 插件 : Generation error: Missing [assembly:GeneratorPlugin] attribute in,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18758560/