Forcing Specflow to generate files using a specific version

I recently ran into annoying problem with the lovely Specflow. The latest Visual Studio Extension for Specflow was version 1.x. That shouldn’t be very important as each individual project installs all the juicy code via Nuget packages, in my example version 2.x. In theory you should be able to create a new feature file and the 1.x Extension should use the 2.x code generator. This is especially important as 2.x now uses a later version of NUnit where 1.x still uses older unsupported attributes. To put it another way, if you want to use the latest version of NUnit then you need to be using the latest version of the Specflow code generator. The problem is that every now and again the 1.x Extension becomes confused and reverts back to using the 1.x generator. This causes the build to fail, and worse still you typically have to restart Visual Studio before it magically decides to use the 2.x generator…ARRGH!

Fortunately not all is lost. When the Extension starts it looks into the App.Config for various settings, one of which is the path to the generator is should use. So be explicit;

<specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
    <generator
       allowDebugGeneratedFiles="false"
       allowRowTests="true"
       generateAsyncTests="false"
       path="<your path>\packages\SpecFlow.2.2.1\tools" />
  </specFlow>
Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s