6

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

有什么想法是什么原因造成的?谢谢

4

2 回答 2

3

通过将以下“路径”属性添加到生成器 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>
于 2013-09-13T06:12:33.170 回答
0

我通过在我的 SpecflowPlugin 项目中将所有引用的 TechTalk.SpecFlow dll 的本地复制标志设置为 false 来解决此问题。

于 2018-04-10T15:21:00.330 回答