SpecFlow.VisualStudio icon indicating copy to clipboard operation
SpecFlow.VisualStudio copied to clipboard

'Could not find a reference to SpecFlow in project' after edit a feature file

Open Planche95 opened this issue 5 years ago • 4 comments

SpecFlow Version:

  • [x] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Visual Studio Version

  • [ ] VS 2019
  • [x] VS 2017
  • [ ] VS 2015

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No

.NET Framework:

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

Test Execution Method:

  • [x] Visual Studio Test Explorer
  • [ ] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [ ] Command line – PLEASE SPECIFY THE FULL COMMAND LINE

Issue Description

When I edit the feature file the cs file generated behind contains:

#error Could not find a reference to SpecFlow in project ''. #error Please add the 'TechTalk.SpecFlow' package to the project and use MSBuild generation instead of using SpecFlowSingleFileGenerator. #error For more information see https://specflow.org/documentation/Generate-Tests-from-MsBuild/

I have to build the project manually to generate proper test file. Do know this issue?

Planche95 avatar May 09 '19 12:05 Planche95

Did you follow the link?

Stephen-Mc avatar May 09 '19 13:05 Stephen-Mc

Yes, I have SpecFlow.Tools.MsBuild.Generation nuget package installed and SpecFlowSingleFileGenerator removed from properties

Planche95 avatar May 09 '19 14:05 Planche95

@Planche95 are you sure you removed all of them and did a build? In the build the code-behind files are regenerated and the #error messages should go away.

SabotageAndi avatar May 09 '19 14:05 SabotageAndi

@SabotageAndi if I run the build the files are regenerated properly. My issue is that if I made changes to a features (without build), i get this error's instead of properly generated tests, and because of that my specflow test's dissapear from my Test Explorer and I lost all information about my previous test run

Planche95 avatar May 13 '19 08:05 Planche95