digitig
digitig

Reputation: 2150

SpecFlow not finding packages even when installed through NuGet

I've installed SpecFlow using the NuGet console, and it says it's installed correctly:

Install-Package SpecFlow.NUnit
Attempting to resolve dependency 'SpecFlow'.
Attempting to resolve dependency 'NUnit (≥ 2.6)'.
'SpecFlow.NUnit 1.1.1' already installed.

Install-Package SpecFlow
'SpecFlow 1.9.0' already installed.

But when I try to build I get errors:

error CS0246: The type or namespace name 'TechTalk' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)

Also, I don't get the context menu for creating the step definitions. SpecFlow feature is available as a project type, though, and syntax highlighting works fine for the gherkin file.

So what am I missing?

Upvotes: 3

Views: 2654

Answers (1)

William
William

Reputation: 1

So I know this question is old, but I came across it while trying to fix a similar problem today. Just in case anyone else comes across this problem, here's my solution, hope it helps.

I had six projects which I tried to add SpecFlow 2.1 to using nuget. Two were successful, four did not show the dll in references and gave errors about (are you missing a using directive or an assembly reference?). After some digging around I noticed that the two projects that were successful were targeting .NET 4.5 in their project properties and the four that weren't were targeting .NET 4.0. I changed them all to target 4.5.2 and hey-presto, adding specflow through nuget worked fine.

If anyone gets a similar problem, checking your project properties might be worth a try.

enter image description here

Upvotes: 0

Related Questions