Specflow 生成错误 - 无法识别的属性 'property'

Specflow Generation Errors - Unrecognised attribute 'property'

我在使用 Specflow 时,在纠正测试的中途它刚刚停止工作并出现以下错误:我已经尝试回滚我的更改,但我仍然得到相同的结果。

我还重新安装了 specflow 并完全删除了 mt nuget 包并恢复了它们。没有变化。

在尝试构建其中包含 specflow 的项目时,我在所有 .feature 文件中遇到以下错误:

#error Generation error: SpecFlow configuration error -> Unrecognized attribute 'property'. Note that attribute names are case-sensitive.

另外 运行 我的功能文件上的 specflow 自定义工具我也遇到了上述错误。

NCRunch 还抱怨 specflows MSBuild XML 文件出现以下错误消息:

..\packages\SpecFlow.2.1.0\tools\TechTalk.SpecFlow.targets (47, 5): SpecFlow configuration error

我发现问题与我的应用程序配置有关。由于某种原因,它更改为以下内容:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section property="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity property="FakeItEasy" publicKeyToken="eff28e2146d5fd2c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity property="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
    <unitTestProvider property="xUnit" />
  </specFlow>


</configuration>

需要将两个 属性 属性更改为名称:

  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>


  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
    <unitTestProvider name="xUnit" />
  </specFlow>