Specflow插件:生成错误:缺少[assembly:GeneratorPlugin]属性(Specflow plugin : Generation error: Missing [assembly

编程入门 行业动态 更新时间:2024-10-23 20:27:51
Specflow插件:生成错误:缺少[assembly:GeneratorPlugin]属性(Specflow plugin : Generation error: Missing [assembly:GeneratorPlugin] attribute in)

我正在编写一个自定义插件来自定义SpecFlow生成的自动生成的代码文件。

构建解决方案并将其放入SpecFlow测试项目的“lib”文件夹之后。 保存我得到的SpecFlow功能文件

Specflow plugin : Generation error: Missing [assembly:GeneratorPlugin] attribute in 'path to dll'

即使我在插件程序集中标记了这一点

[assembly: GeneratorPluginAttribute(typeof(CustomGeneratorPlugin))]

使用反射/自我测试我可以自己加载程序集并解析属性

代码在这里 - https://github.com/chrismckelt/SpecFlowCustomPlugin

有什么想法导致这个? 谢谢

I am writing a custom plugin to customise the auto-generated code files SpecFlow produces.

After building the solution and putting it in the 'lib' folder of the SpecFlow testing project. On saving the SpecFlow feature file I get

Specflow plugin : Generation error: Missing [assembly:GeneratorPlugin] attribute in 'path to dll'

Even though I have this marked up in the plugin Assembly

[assembly: GeneratorPluginAttribute(typeof(CustomGeneratorPlugin))]

Using reflection/self-testing I can load the assembly myself and resolve the attribute

Code is here -- https://github.com/chrismckelt/SpecFlowCustomPlugin

Any ideas whats causing this? Thanks

最满意答案

通过将以下'path'属性添加到生成器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>

Resolved by adding the below 'path' attribute to the generator SpecFlow config section

<generator path=".\lib"

full config

<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>

更多推荐

SpecFlow,assembly,plugin,测试,电脑培训,计算机培训,IT培训"/> <meta name="d

本文发布于:2023-07-26 00:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1268335.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   属性   错误   GeneratorPlugin   assembly

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!