How to regenerate designer code for all SpecFlow features

Greg Burghardt picture Greg Burghardt · Sep 22, 2014 · Viewed 18.1k times · Source

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

Answer

Sam Holder picture Sam Holder · Sep 22, 2014

You can right click on the project and choose 'regenerate feature files' to do them all at once.