SolvedSpecFlow Could not find a reference to SpecFlow in project because of SpecFlowSingleFileGenerator

SpecFlow Version:

  • 3.0
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.9

Used Test Runner

  • SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number:

Visual Studio Version

  • VS 2019
  • VS 2017
  • VS 2015

Are the latest Visual Studio updates installed?

  • Yes
  • No

.NET Framework:

  • >= .NET 4.5
  • before .NET 4.5
  • .NET Core 2.0
  • .NET Core 2.1
  • .NET Core 2.2
  • .NET Core 3.0

Test Execution Method:

  • Visual Studio Test Explorer

<SpecFlow> Section in app.config or content of specflow.json


Issue Description

When I edit my scenarios, I'm getting errors like :

#error Could not find a reference to SpecFlow in project 'projectname'.
#error Please add the 'TechTalk.SpecFlow' package to the project and use MSBuild generation instead of using SpecFlowSingleFileGenerator.
#error For more information see

My teammates have no problem with this. I have already recloned repo, reinstalled my VS and nothing helps...Did someone meet such issue?

46 Answers

✔️Accepted Answer


We were facing the same problem while using Specflow for Visual Studio 2017 and 2019 with an older package reference. Due to internal pipelines we cannot fully migrate to newer versions of specflow yet. We were not able to generate any codebehind for specflow feature files after latest Specflow update. It seems that this happened due to an update yesterday May 8th.

A workaround we did in our dev team was:

Our application is a NET Core 2.0 with output type Console application.

Here is our App.config

<?xml version="1.0" encoding="utf-8"?>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
    <!-- For additional details on SpecFlow configuration options see -->
    <unitTestProvider name="MsTest" />

and csproj sample

<Project Sdk="Microsoft.NET.Sdk">

    <Content Include="App.config">
    <None Update="Services\Cache\Features\SpecFlowFeature1.feature">

    <PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
    <PackageReference Include="Microsoft.Extensions.Hosting" Version="2.2.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
    <PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
    <PackageReference Include="NUnit" Version="3.11.0" />
    <PackageReference Include="SpecFlow" Version="2.2.1" />
    <PackageReference Include="StackExchange.Redis" Version="1.2.6" />
    <PackageReference Include="System.Net.Http" Version="4.3.0" />

@orestsyniavskyi Have a go to check if this could solve your problem

Other Answers:

I have the same issue. Everything was working fine until today. We're using package references and net472;
<PackageReference Include="SpecFlow" Version="2.4.0" />

#error Could not find a reference to SpecFlow in project '[Name]'.
#error Please add the 'TechTalk.SpecFlow' package to the project and use MSBuild generation instead of using SpecFlowSingleFileGenerator.
#error For more information see

Thanks, @juniormayhe, it works now. Problem is with new version of specflow extension.

Related Issues:

SpecFlow Specflow Test not appearing in Test Explorer
@chaturvediankit I think i just needed to include the SpecFlow.Tools.MsBuild.Generation That seems t...
SpecFlow Could not find a reference to SpecFlow in project because of SpecFlowSingleFileGenerator
Hello We were facing the same problem while using Specflow for Visual Studio 2017 and 2019 with an o...
mocha timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.
just add in your package.json under scripts Then you can just run I'm getting the following error wh...
mocha Error: Resolution method is overspecified.
async functions (babel) with done also break. This: will result in an error Error: Resolution method...
mocha mocha 4 doesn't exit unlike mocha 3
Other than providing a quick fix (use --exit) I do agree they left the core issue of finding the fau...
mocha Async test fails with timeout instead of assertion error
I ran into a similar problem and eventually realized you shouldn't use done when testing asynchronou...
mocha Cannot find module 'tap', but tap isn't listed as a dependency
It's something I run into as well I think that 's because you run a test from your node_modules ...
mocha Error: Cannot find module './options' (fresh start)
@damienromito I have experienced this issue soooooo many times with Mocha 3.x it is just routine to ...
mocha this.timeout() inside describe() doesn't work for me
For posterity you can use arrow functions and set the timeout like this: This below JS snippet is fr...
mocha Deprecate --watch
All the proposed alternatives here seem to ignore the main point: Mocha's --watch is so useful becau...
mocha Vulnerability Advisory flaggs 1 high vulnerability in js-yaml for mocha@6.1.3
@boneskull why is mocha doing js-yaml: 3.13.0,? If you you had js-yaml: ^3.13.0 there would be nothi...
karma Node v4.2.6 - FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
If others are having this issue still hey there - i'm hitting the following error after upgrading to...
karma Karma 1.6 breaks Headless support for Chrome
Got into this with karma v1.7.0 Google Chrome 59.0.3071.86 Karma version (output of karma --version)...
Behat 3.4.0 breaks the ability to run individual tests
On a side note Update + quick fix This is a long standing issue which is affecting many users It has...
mocha Data-generated test cases (parameterized tests)
With all my respect the proposed solution sucks First of all the error message will be expected fals...
karma Karma 0.13.19 taking long time to complete when run via gulp
I am also seeing this on version 1.1.1. I am opening a new ticket as this seems to be fallout from #...
mocha Add a way of a programmatically skipping a test
How about this? I have a code where certain tests will always fail in CI environment I would like to...
mocha Mocha configuration with webpack 2 Tree Shaking
I did this: and then NODE_ENV=test mocha.. - did the trick for me. With Webpack 2 we get a built-in ...
mocha Cannot combine --delay and --watch and --require hook
@Download I have no babel experience per se but your repo problem would seem a little more basic tha...
mocha To specify watching directories with mocha-cli
Any progress on this? @dennisbaskin I cant find the option --watch-dirs in the docs where is that fr...
mocha Possible Bug with mocha new configuration file
Hi I had a similar issue to this happen to me earlier today Hi I need help with an issue with mocha ...
Pester v5: Discussion
After writing this I am not 100% sur if this should be in this thread Although the -Passthru object ...
godog write output to a file
We have decided to implement this: Where the progress formatter would write to stdout and the junit ...
axios Axios catch error returns javascript error not server response
I have exactly the same environment Try this: Modify from console.log(error) to console.log(
scrapy ' error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 '
@euler16 for scrapy with Python 3 you'll need with Python 2 you'll need I wanted to install scrapy i...
laradock Mysql. The server requested authentication method unknown to the client [caching_sha2_password]
alter user 'username'@'localhost' identified with mysql_native_password by 'password'; would fix it....
react navigation screenIsActive prop / componentDidFocus event for TabNavigator items
It probably makes sense to add lifecycle hooks to screens In one of my Tabs i need to load Data from...
meteor [] Error: ENFILE: file table overflow
I was getting the same after an upgrade to macOS Sierra Turns out macOS have a harsh limit on number...
ipython Last jedi release (0.18.0) is incompatible with ipython (7.19 and 7.18 tested); reason - column arg was deprecated, and now removed
As a temporary fix for anyone just trying to get things working again: It would be really nice if yo...
material ui Module not found: Can't resolve 'material-ui-icons/Menu' Martial Next
For anyone else experiencing this issue: npm install @material-ui/icons
laravel dompdf (1/1) ErrorException Non-static method Barryvdh\DomPDF\PDF::loadView() should not be called statically
This happens because you are namespacing the wrong PDF class You are namespacing Barryvdh\DomPDF\PDF...
webpacker localIdentName option moved in css-loader configuration
I faced same issue after upading css-loader but I solved it If you check css-loader readme ...
react navigation Send data back from child screen?
@itswaze You can do something along these lines to pass back from the child screen ...
react navigation How to goBack from nested StackNavigator?
@dhruvparmar372 According to the NOTE in the doc a navigator's navigation prop may not have the help...
axios POST request works in Browser but not on Node
This might be considered a duplicate of #789 I was able to use the form-data package with Axios in n...
react navigation Best pattern for a 'Save' button in the header
Try setting your component instance's handleSave function as a navigation state parameter after the ...
DefinitelyTyped [@types/react] RefObject.current should no longer be readonly
It's not It'a intentionally left readonly to ensure correct usage even if it's not frozen ...
react native navigation [V3][Android] FATAL EXCEPTION: create_react_context
OK after a good night of sleep I've found why I was having this issue In the I ...
ts node Custom typings not working with ts-node 8.0.2
When using with ts-node you have to add --files flag After updating to ts-node version 8.0.2 the cus...
ohmyzsh compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew
Per #9602 (comment) brew cleanup fixed it for me I am using Apple M1 When I added this line: export ...
laradock SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
+1 I'm having the same problem here. Info: Docker version ($ docker --version): Docker version 17.12...
vagrant vagrant box update - Fails with 404 Not Found error
A workarround to add in your Vagrantfile: Vagrant version Host operating system Ubuntu 16.04.3 LTS G...
vagrant vagrant --help displays a rubygems error
To fix this error: Vagrant version Host operating system Expected behavior vagrant and vagrant --hel...
date fns Can't resolve 'date-fns/_lib/format/longFormatters'
You probably forgot to install date-fns or Code: import DateFnsUtils from '@date-io/date-fns'; ...
virtualenv Error creating virtualenv with python3.6
The original poster's problem is due to not having the 'python3.6-venv' package installed ...
provider A Product was used after being disposed. flutter: Once you have called dispose() on a Product, it can no longer be used.
Oh I see what you're doing Don't: DO: i have a ChangeNotifireProvider that such that i do pushReplac...
react navigation Reset to nested route, "There is no route defined for..."
A quick workaround (not heavily tested): set the key property to null on your action. ...
axios Adding headers to method
Edit: I had to add Authorization to allowed headers in my CORS filter @jffernandez I'm having the sa...
axios Adding Retry Parameter
@mericsson I am too in need of exponential backoff when retrying I've put together the following whi...