问题
I am getting the following error while trying to build my automation solution. Due to which i am unable to change anything in my feature file at the moment.
error Version conflict - SpecFlow Visual Studio extension attempted to use SpecFlow code-behind generator 1.9, but project 'POC.Specs' references SpecFlow 2.0.
error We recommend migrating to MSBuild code-behind generation to resolve this issue.
error For more information see https://specflow.org/documentation/Generate-Tests-from-MsBuild/
.net version 4.6.2 Specflow 2.0.0 TestStack White Visual Studio 2015
I have tried reinstalling specflow 2.0.0 but still the same issue persists
Any help would be really appreciated.
回答1:
The following steps resolved the issue for me:-
- Add the NuGet package SpecFlow.Tools.MsBuild.Generation with the same version as SpecFlow to your project.
- Remove all SpecFlowSingleFileGenerator custom tool entries from your feature files.(go to the file properties and delete the value for custom tool)
- Select Tools | Options | SpecFlow from the menu in Visual Studio, and set Enable SpecFlowSingleFileGenerator CustomTool to "false".
Try Step 3 first to resolve the problem. If that doesnt do the trick, go from Step 1 onwards.
refer link
回答2:
Clear the error message in .cs file under the feature file and then rebuild the code
回答3:
This issue did my head in. Basically the fix was simple. My specflow extention was modified to specflow 3.0 changes and this issue that I was getting was for a project on specflow 2.4.1 The steps that I did to fix was simple.
- Reverted back the changes done to specflow extension. Eg: Tools->options->specflow and reverted back Enable Specflowsinglefilegenrator to True
- Cleared Nuget cache.
- Deleted the package folder.
- Upgraded/Freshly installed Nunit latest.
- Upgraded/Freshly installed Nunit3TestAdapter. Spet 4 was the most important step.
来源:https://stackoverflow.com/questions/56501929/specflow-visual-studio-extension-attempted-to-use-specflow-code-behind-generator