I've got ~30 SpecFlow feature files, and I recently removed the Foo.feature.cs files from source control because I got sick of resolving merge conflicts in Designer Generated code.
I did not exclude or remove these files from my Visual Studio project, so Visual Studio still thinks they should be there, they are just missing on the hard disk.
Ideally I'd like to just click on a root folder and regenerate all the code behind files, but no such option exists for VS 2010 and SpecFlow 1.9. I'd even be OK with programmatically regenerating them from the command line, creating another custom tool or adding a pre-compile build event.
Is there a way to regenerate all of the the Designer generated code behind files for SpecFlow features (*.feature.cs files) without right-clicking on each .feature file and clicking "Run Custom Tool"?
The only way to regenerate it is to right-click on the project containing specs and choose "Regenerate Feature Files". This action regenerates all feature files, which becomes slow when a project has many feature files.
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.
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.
Remove all SpecFlowSingleFileGenerator custom tool entries from your feature files. Select Tools | Options | SpecFlow from the menu in Visual Studio, and set Enable SpecFlowSingleFileGenerator CustomTool to “false”.
You can right click on the project and choose 'regenerate feature files' to do them all at once.
It runs much quicker from the command prompt. Go to your Specflow package tools folder and run the following command line. It also ensures the correct Specflow version is added to the files.
specflow.exe generateall <My_Testing.csproj>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With