Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet test throws "GenerateFeatureFileCodeBehindTask" failed error #1965

Closed
6 of 31 tasks
thegrandpoobah opened this issue May 1, 2020 · 4 comments
Closed
6 of 31 tasks

Comments

@thegrandpoobah
Copy link

SpecFlow Version:

  • 3.1
  • 3.0
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.9

Used Test Runner

  • [x ] SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number: 3.2.22

Project Format of the SpecFlow project

  • Classic project format using packages.config
  • [x ] Classic project format using <PackageReference> tags
  • Sdk-style project format

(I think?)

.feature.cs files are generated using

  • SpecFlow.Tools.MsBuild.Generation NuGet package
  • SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • VS 2019
  • VS 2017
  • VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • Enabled
  • Disabled

Are the latest Visual Studio updates installed?

  • Yes
  • No, I use Visual Studio version <Major>.<Minor>.<Patch>

.NET Framework:

  • >= .NET 4.5
  • before .NET 4.5
  • .NET Core 2.0
  • .NET Core 2.1
  • .NET Core 2.2
  • .NET Core 3.0
  • .NET Core 3.1

Test Execution Method:

  • Visual Studio Test Explorer
  • TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [x ] Command line (dotnet test project_folder)

<SpecFlow> Section in app.config or content of specflow.json


Repro Project

Issue Description

I created a specflow test project as per the instructions. I also installed the Visual Studio Extension. THe feature file is there, the steps are generated, everything compiles according to Visual Studio, but when you go to run the test, the test has a blue exclamation mark next to it and says "1 Not Run" in OutComes, but with no explanation of why.

I tried to run the tests from the command prompt using dotnet test <project_name> and it returned the following errors:

C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: TechTalk.SpecFlow.SpecFlowException: Missing [assembly:GeneratorPlugin] attribute in C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specrun.specflow.3-1-0\3.2.22\build\\netstandard2.0\SpecRun.Generator.SpecFlowPlugin.dll [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at TechTalk.SpecFlow.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor) [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.LoadPlugins(ObjectContainer container, GeneratorPluginEvents generatorPluginEvents, UnitTestProviderConfiguration unitTestProviderConfiguration, IEnumerable`1 generatorPlugins) [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings, IEnumerable`1 generatorPluginInfos, IObjectContainer parentObjectContainer) [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at SpecFlow.Tools.MsBuild.Generation.WrappedGeneratorContainerBuilder.BuildGeneratorContainer(SpecFlowConfigurationHolder specFlowConfigurationHolder, ProjectSettings projectSettings, IReadOnlyCollection`1 generatorPluginInfos, IObjectContainer rootObjectContainer) [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTaskExecutor.Execute() [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask.Execute() [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]
C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\sahab\source\repos\Address_and_Property_Lookup\FCT.PropertyLookupService.Spec\FCT.PropertyLookupService.Spec.csproj]

So it looks like the root error is error MSB4018: TechTalk.SpecFlow.SpecFlowException: Missing [assembly:GeneratorPlugin] attribute in C:\Users\sahab\source\repos\Address_and_Property_Lookup\packages\specrun.specflow.3-1-0\3.2.22\build\\netstandard2.0\SpecRun.Generator.SpecFlowPlugin.dll but I have no idea why.

Thoughts on how to fix this? More than happy to provide any more information that you may need.

Thanks,
Sahab

@thegrandpoobah
Copy link
Author

Here is a repo that reproduces the issue on my computer: https://github.com/thegrandpoobah/specflow1912

@SabotageAndi
Copy link
Contributor

Could it be that is a duplicate of #1912 ?

@thegrandpoobah
Copy link
Author

It looks like it. Adding the environment variable proposed in #1912 fixed the issue for me. Thanks!

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants