I have been evaluating SpecFlow and getting it running in Visual Studio 2017 has not been easy.
I created a .Net Framework 4.6.2 project and these are the problems that I encountered and how I fixed them.
SpecFlow designer codebehind generation is not compatible with MSBuild codebehind generation. The custom tool must be removed from the file.
- Set Enable SpecFlowSingleFileGenerator CustomTool to false
- Ensure that SpecFlowSingleFileGenerator is not entered in the Custom Tool field of your feature files
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘netstandard, Version=126.96.36.199, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies. The system cannot find the file specified.
Solution: Install .Net Framework 4.7.1 on your machine, this includes .NET Standard as well which is required for SpecFlow if the project is using .NET Framework.
I also tried this but it did not work:
- Add reference from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\lib
- Add reference from Nuget to NETStandard.Library