c# - Specflow 插件 : Generation error: Missing [assembly:GeneratorPlugin] attribute in

标签 c# .net-assembly specflow xunit

我正在编写一个自定义插件来自定义 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/

相关文章:

c# - 使用 HttpWebRequest 从 C# 连接到 Tagpacker.com

specflow - Specflow 场景中的强类型值

java - C# 从类型创建类的实例

c# - 无法识别的元素 unitTestProvider

c# - 如何获得场景大纲示例迭代次数

c# - SqlCommand 不能删除触发器

c# - 静态数据库上下文的困惑

c# - FluentValidation NullReferenceException - 防止检查空值的方法?

c# - 使用 SQL 过程替换文件中的字符串

c# - 'Nancy.Bootstrapper.AppDomainAssemblyTypeScanner' 的类型初始值设定项引发异常