Ankit Rathi
Ankit Rathi

Reputation: 119

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

Upvotes: 1

Views: 2504

Answers (2)

Ankit Rathi
Ankit Rathi

Reputation: 119

After above solution, I was getting an error shown in below screen capture.

enter image description here

The reason behind this error was my project was linked to TFS and feature.cs file was not updated as it was at lock state.

enter image description here

When that file was check out for edit, feature.cs file was getting updated automatically.

Upvotes: 0

Andreas Willich
Andreas Willich

Reputation: 5825

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

Upvotes: 3

Related Questions