Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpecFlow Visual Studio extension attempted to use SpecFlow code-behind generator 1.9

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.

like image 287
logesh praveen Avatar asked Jun 07 '19 22:06

logesh praveen


People also ask

How to Enable SpecFlow in Visual Studio?

To enable the extension in Visual Studio, select Tools | Extensions and Updates…, select the “SpecFlow for Visual Studio” extension, then select Enable.

What is contained in the auto generated file for the SpecFlow feature?

Q #3) What is contained in the auto-generated file for the Specflow feature? Answer: Specflow code-behind files are auto-generated files with a “. cs” extension. These files have the binding logic from Steps to the actual Step definition.

How do I generate a CS feature in Visual Studio?

make sure spec flow is installed: Tools->Extensions and updates -> SpecFlow for Visual Studio 2015. set Tools->Options->SpecFlow->Legacy->Enable SpecFlowSingleFileGenerator CustomTool = TRUE. Uninstall Tools->Extensions and updates -> SpecFlow for Visual Studio 2015. Restart Visual Studio.


1 Answers

The following steps resolved the issue for me:-

Try Step 3 first to resolve the problem. If that doesnt do the trick, go from Step 1 onwards.

  1. Add the NuGet package SpecFlow.Tools.MsBuild.Generation with the same version as SpecFlow to your project.
  2. Remove all SpecFlowSingleFileGenerator custom tool entries from your feature files.(go to the file properties and delete the value for custom tool)
  3. Select Tools | Options | SpecFlow from the menu in Visual Studio, and set Enable SpecFlowSingleFileGenerator CustomTool to "false".

refer link

like image 69
Sourav Mondal Avatar answered Sep 23 '22 11:09

Sourav Mondal