Skip to content
Matthew Adams By Matthew Adams Co-Founder
Configuring SpecFlow for XUnit using new-style csproj

[This post is now obsolete - you should look at updating to later versions of SpecFlow]

While you cannot yet use SpecFlow with netcore or netstandard projects, you can use new-style (dotnet) test projects that target net461, and reference netstandard projects-under-test from there.

We like to use XUnit as the underlying test provider in this scenario, and we do the following:

  1. Install the current SpecFlow VS 2017 extension into VS 2017
  2. Create a DotNetCore XUnit test project and perform any package updates offered to you (this handily sets up the VS2017 test environment properly)
  3. Change the <TargetFramework> in the .csproj file from dotnetcore2.x to net461 (or 462, or whatever, but 461 is a good safe lowest common denominator for most scenarios)
  4. Add the SpecFlow.XUnit package to your project
  5. Add an app.config file to configure XUnit code generation

You can now add feature files and generate steps in the normal way.

Matthew Adams

Co-Founder

Matthew Adams

Matthew was CTO of a venture-backed technology start-up in the UK & US for 10 years, and is now the co-founder of endjin, which provides technology strategy, experience and development services to its customers who are seeking to take advantage of Microsoft Azure and the Cloud.