规格生成错误 - 无法识别的属性“属性”

时间:2016-10-02 07:04:51

标签: visual-studio-2015 msbuild specflow

我正在使用Specflow,正好在测试时,它刚刚停止使用下面的错误:我已经尝试将我的更改推回去了,我仍然得到相同的结果。

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

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

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

还在我的功能文件上运行specflow自定义工具,我也得到了上述错误。

NCRunch也在抱怨MSBuild XML文件的specflow,并出现以下错误消息:

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

1 个答案:

答案 0 :(得分:1)

我发现问题与我的应用配置有关。由于某种原因,它改为:

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

需要将两个属性属性更改为name:

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