Specflow: Build of project with installed SpecFlow.Tools.MsBuild.Generation is failing on Linux and .NET 5.0.100-preview.2.20120.11

Created on 4 Mar 2020  Â·  18Comments  Â·  Source: SpecFlowOSS/SpecFlow

SpecFlow Version:

  • [x] 3.1
  • [ ] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Used Test Runner

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


Version number:

Project Format of the SpecFlow project

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

.feature.cs files are generated using

  • [x] SpecFlow.Tools.MsBuild.Generation NuGet package
  • [ ] SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • [x] 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?

  • [x] 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
  • [x] .NET 5.0.100-preview.2.20120.11

Test Execution Method:

  • [ ] Visual Studio Test Explorer
  • [ ] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [ ] Command line – PLEASE SPECIFY THE FULL COMMAND LINE

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


Repro Project


https://github.com/ObjectivityLtd/Ocaramba/tree/3.2.8/Ocaramba.Tests.Features

Issue Description


Build of project with installed SpecFlow.Tools.MsBuild.Generation is failing on Linux . there is no such problem on Windows

https://ci.appveyor.com/project/ObjectivityAdminsTeam/ocaramba/builds/31229837/job/0o2m3sl863sb324q

logs:
dotnet build --configuration Release /verbosity:minimal "Ocaramba.sln"
Microsoft (R) Build Engine version 16.6.0-preview-20105-01+5d872c945 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 78.28 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.PageObjects/Ocaramba.Tests.PageObjects.csproj.
Restore completed in 80.77 ms for /home/appveyor/projects/ocaramba/OcarambaLite/OcarambaLite.csproj.
Restore completed in 1.92 ms for /home/appveyor/projects/ocaramba/Ocaramba/Ocaramba.csproj.
Restore completed in 2.52 ms for /home/appveyor/projects/ocaramba/Ocaramba.UnitTests/Ocaramba.UnitTests.csproj.
Restore completed in 2.15 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.Xunit/Ocaramba.Tests.Xunit.csproj.
Restore completed in 2.46 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.NUnit/Ocaramba.Tests.NUnit.csproj.
Restore completed in 17.18 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.MsTest/Ocaramba.Tests.MsTest.csproj.
Restore completed in 9.4 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.Features/Ocaramba.Tests.Features.csproj.
Restore completed in 2 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.CloudProviderCrossBrowser/Ocaramba.Tests.CloudProviderCrossBrowser.csproj.
Restore completed in 2.14 ms for /home/appveyor/projects/ocaramba/Ocaramba.Tests.Angular/Ocaramba.Tests.Angular.csproj.
You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
SpecFlowFeatureFiles: TestFeatures/SmokeTests.feature
/home/appveyor/.nuget/packages/specflow.tools.msbuild.generation/3.1.86/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [/home/appveyor/projects/ocaramba/Ocaramba.Tests.Features/Ocaramba.Tests.Features.csproj]
/home/appveyor/.nuget/packages/specflow.tools.msbuild.generation/3.1.86/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. The system cannot find the file specified.

Steps to Reproduce

.NET Core Support

Most helpful comment

This is happening on the .NET Core 3.1 release SDK that came out in the last 24 hours (SDK 3.1.200, MSBuild 16.5.0). Our hosted devops builds started failing randomly. Pinning the previous SDK version (SDK 3.1.102, MSBuild 16.4.0) allowed our builds to succeed again.

All 18 comments

I noticed similar issues with the .NET Core 3.1 preview SDK. It is working with the release SDK.
I didn't have yet time to have a look at this issue.

If you pin your sdk via global.json to a non review version, do you still get the error?

This is happening on the .NET Core 3.1 release SDK that came out in the last 24 hours (SDK 3.1.200, MSBuild 16.5.0). Our hosted devops builds started failing randomly. Pinning the previous SDK version (SDK 3.1.102, MSBuild 16.4.0) allowed our builds to succeed again.

We have similar issues after upgrading build serveres to dotnet SDK 3.1.200. Specflow version 3.1.86.

we have similar issue with circleci

C:Userscircleci.nugetpackagesspecflow.tools.msbuild.generation3.1.86buildSpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [C:Userscircleciprojectspecs

See https://github.com/SpecFlowOSS/SpecFlow/issues/1912
There is a workaround available.

The workaround aren't working here.

C:\Users\Gabriel\.nuget\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: Falha inesperada da tarefa "GenerateFeatureFileCodeBehindTask". [C:\Users\Gabriel\source\repos\projeto_insumos_backend\Insumos.Assignment.Test\Insumos.Assignment.Test.csproj]
C:\Users\Gabriel\.nuget\packages\specflow.tools.msbuild.generation\3.1.97\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. O sistema não pode encontrar o arquivo especificado. [C:\Users\Gabriel\source\repos\projeto_insumos_backend\Insumos.Assignment.Test\Insumos.Assignment.Test.csproj]

@GabrielHSFerreira please try the SpecFlow 3.3 beta. This version has fixes for this issue.

@GabrielHSFerreira please try the SpecFlow 3.3 beta. This version has fixes for this issue.

It worked for me. Thank you so much!

@GabrielHSFerreira please try the SpecFlow 3.3 beta. This version has fixes for this issue.

I can not see specFlow 3.3 version in my visaul studio 2019. I can see latest version is 3.1.97

@Mahesh-Coder-K 3.3 is currently only available as a pre-release package. You have to check the box for that to get it.

@SabotageAndi are you going yo update specrun.specflow to support Specflow 3.3 ?

@conmatf-cg Yes, we are currently working on the SpecFlow 3.3 support for SpecFlow+ Runner.

SDK 3.1.102,

This is happening on the .NET Core 3.1 release SDK that came out in the last 24 hours (SDK 3.1.200, MSBuild 16.5.0). Our hosted devops builds started failing randomly. Pinning the previous SDK version (SDK 3.1.102, MSBuild 16.4.0) allowed our builds to succeed again.

I solved issue on my project by commentin out

<!-- <PackageReference Include="SpecFlow.MsTest" Version="3.3.57" /> -->

https://github.com/hack2root/build

This issue is solved with SpecFlow 3.3. SpecFlow+ Runner 3.3 is also out.

This issue is solved with SpecFlow 3.3. SpecFlow+ Runner 3.3 is also out.

Can you uncomment on my project and recheck?

@hack2root I checked your project.
You have also SpecFlow.NUnit in your project. You can't add both packages to the same project. These packages configure the used unit test provider in SpecFlow.

@hack2root I checked your project.
You have also SpecFlow.NUnit in your project. You can't add both packages to the same project. These packages configure the used unit test provider in SpecFlow.

I think i fixed it by commentig out SpecFlow.NUnit, all worked as a charm! Thanks for the SpecFlow great support!

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.

Was this page helpful?
0 / 5 - 0 ratings