Search code examples
c#automated-testsvisual-studio-2019bddspecflow

Specflow generated feature.cs file is not getting updated


When I make changes in Specflow feature file, its not updating feature.cs file automatically and getting an error [Specflow] System.Unauthorized.Access.Exception

I am using Specflow version 3.1.97 in Visual studio 2019 and below is the configuration of Specflow extension

enter image description here


Solution

  • Since SpecFlow 3, you can't anymore use the SpecFlowSingleFileGenerator.

    You have to use the MSBuild integration to generate the code-behind files. But this is easy. You have simply to add the SpecFlow.Tools.MSBuild.Generation NuGet package to your project. If you still have configured a custom tool for your feature files, you have to remove this.

    You can find more information here: https://docs.specflow.org/projects/specflow/en/latest/Tools/Generate-Tests-From-MsBuild.html