SpecFlow and PackageReference

By default, the packages used in SpecFlow projects are stored in packages.config. However the new Visual Studio projects instead use the PackageReference element to reference packages. When using the PackageReference element, generator plugins will not be found, and you will see errors similar to the following:

Unable to find plugin in the plugin search path: SpecRun. Please check http://go.specflow.org/doc-plugins for details.
#error TechTalk.SpecFlow.Generator

This is due to SpecFlow not searching for the package in the correct location. To ensure that the plugin is found, you need to specify the path explicitly in your app.config file.

To do so, enter the path to the appropriate path in the plugins element of your app.config file in this case, e.g.:

      <add name="SpecRun" path="%USERPROFILE%\.nuget\packages\specrun.specflow.2-3-0\1.7.0\lib\net45" />

IMPORTANT! You will need to manually update this path when upgrading to a newer version of the package, as the path contains the version number (e.g. “1.7.0” in the above example).

You can find a sample project using the new project format here. The relevant line in the app.config file is here.

Note: This requires SpecFlow 2.3.2 of higher. This step should not be necessary once SpecFlow 3 is released.