Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpecFlow - The name 'GenerationTargetLanguage" does not exists in the current context - build error

Tags:

.net

specflow

I'm getting this error trying to build a project. It's highlighting words in my feature pages and giving me this error.

Error 1 The name 'GenerationTargetLanguage' does not exist in the current context

I tried to Run Custom Tool on each feature but that made my errors go from two of the same, to three of these errors.

Found one other person with the problem in the google groups. No solution.

like image 524
Mastro Avatar asked Jan 27 '11 03:01

Mastro


3 Answers

I had the same problem when i installed the newest version of specflow and tried to compile an example project because the example had a local copy of an older version of the specflow dll. The new specflow - feature-file compiler generates sourcecode for a call to a non existing specflow-dll method signature.

I solved the problem by replacing the specflow-dll in the projects lib-directory with with the dll from my newer installation.

like image 71
k3b Avatar answered Oct 04 '22 15:10

k3b


I ran into the exact same error under different circumstances. I had originally (early 2011) installed Specflow v1.5.0.0 using the msi installer, but just today used NuGet to install version 1.8.1.0 for a particular project (using Install-Package SpecFlow -ProjectName MyProject).

I quit all instances of Visual Studio, downloaded and ran the msi installer for v1.8.1.0 and then fired up Visual Studio again, deleted my existing feature files and added new ones, and everything worked.

like image 45
Dave Avatar answered Oct 04 '22 15:10

Dave


I found it was a breaking change. In the xyz.feature.cs the enum GenerationTargetLanguage.CSharp should now be replaced with ProgrammingLanguage.CSharp

like image 35
pkr2000 Avatar answered Oct 04 '22 16:10

pkr2000