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

Multiple "Could not load file or assembly errors" after updating to Specflow 3 and MsBuild #1717

Closed
8 of 32 tasks
okyrylenko opened this issue Sep 4, 2019 · 24 comments
Closed
8 of 32 tasks

Comments

@okyrylenko
Copy link

okyrylenko commented Sep 4, 2019

Multiple "Could not load file or assembly errors" after updating to Specflow 3 and MsBuild

SpecFlow Version:

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

Used Test Runner

  • SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number:
3.0.377

Project Format of the SpecFlow project

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

.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

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

<specFlow>
    <runtime stopAtFirstError="false" />
    <stepAssemblies>
        <!-- This attribute is required in order to use StepArgument Transformation as described here; 
            https://github.com/marcusoftnet/SpecFlow.Assist.Dynamic/wiki/Step-argument-transformations  
        -->
        <!-- This attribute is required in order to use StepArgument Transformation as described here; 
https://github.com/marcusoftnet/SpecFlow.Assist.Dynamic/wiki/Step-argument-transformations  --><stepAssembly assembly="Testing.UI.Pages" />
        
    <stepAssembly assembly="SpecFlow.Assist.Dynamic" /></stepAssemblies>           
    
</specFlow>

Repro Project

Issue Description

I am updating from SpecFlow 2 to SpecFlow 3. I followed all the steps on this page - https://specflow.org/2019/updating-to-specflow-3/
When I compile, I get the same exception for every feature file I have in my solution. Exception bellow

Severity	Code	Description	Project	File	Line	Suppression State
Error		Generation error: Message: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

AppDomain Information: 
	Name: MSBuild.exe
	BaseDirectory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\

Loaded Assemblies:
Fullname | Location | Codebase
BoDi, Version=1.4.1.0, Culture=neutral, PublicKeyToken=ff7cd5ea2744b496 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\BoDi.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/BoDi.DLL
Gherkin, Version=6.0.0.0, Culture=neutral, PublicKeyToken=86496cfa5b4a5851 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\Gherkin.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/Gherkin.DLL
Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/Microsoft.Build.DLL
Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/Microsoft.Build.Framework.DLL
Microsoft.Build.Tasks.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/Roslyn/Microsoft.Build.Tasks.CodeAnalysis.dll
Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/Microsoft.Build.Tasks.Core.DLL
Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/Microsoft.Build.Utilities.Core.DLL
Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Build.Utilities.v4.0\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Utilities.v4.0.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.Build.Utilities.v4.0/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.Build.Utilities.v4.0.dll
Microsoft.NET.Build.Extensions.Tasks, Version=2.1.501.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\tools\net46\Microsoft.NET.Build.Extensions.Tasks.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/Microsoft/Microsoft.NET.Build.Extensions/tools/net46/Microsoft.NET.Build.Extensions.Tasks.dll
MSBuild, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/MSBuild.exe
mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll | file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
NuGet.Build.Tasks, Version=4.9.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Build.Tasks.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/CommonExtensions/Microsoft/NuGet/NuGet.Build.Tasks.dll
NuGet.Commands, Version=4.9.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Commands.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/CommonExtensions/Microsoft/NuGet/NuGet.Commands.DLL
NuGet.Common, Version=4.9.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Common.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/CommonExtensions/Microsoft/NuGet/NuGet.Common.DLL
NuGet.Frameworks, Version=4.9.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Frameworks.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/Common7/IDE/CommonExtensions/Microsoft/NuGet/NuGet.Frameworks.DLL
SpecFlow.Tools.MsBuild.Generation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\SpecFlow.Tools.MsBuild.Generation.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/SpecFlow.Tools.MsBuild.Generation.dll
SpecRun.Generator.SpecFlowPlugin, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null | C:\Projects\vNext\src\packages\SpecRun.SpecFlow.3-0-0.3.0.377\build\net471\SpecRun.Generator.SpecFlowPlugin.dll | file:///C:/Projects/vNext/src/packages/SpecRun.SpecFlow.3-0-0.3.0.377/build/net471/SpecRun.Generator.SpecFlowPlugin.dll
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
System.Collections.Concurrent, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Collections.Concurrent\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Collections.Concurrent.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Collections.Concurrent/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Collections.Concurrent.dll
System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\System.Collections.Immutable.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/System.Collections.Immutable.DLL
System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
System.Diagnostics.Tracing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Diagnostics.Tracing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Diagnostics.Tracing.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Diagnostics.Tracing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Diagnostics.Tracing.dll
System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Runtime.dll
System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\System.Runtime.InteropServices.RuntimeInformation.dll | file:///C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/MSBuild/15.0/Bin/System.Runtime.InteropServices.RuntimeInformation.DLL
System.Threading.Tasks, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Threading.Tasks.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Threading.Tasks/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Threading.Tasks.dll
System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Threading.Tasks.Dataflow\v4.0_4.5.24.0__b03f5f7f11d50a3a\System.Threading.Tasks.Dataflow.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Threading.Tasks.Dataflow/v4.0_4.5.24.0__b03f5f7f11d50a3a/System.Threading.Tasks.Dataflow.dll
System.Threading.Tasks.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\System.Threading.Tasks.Extensions.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/System.Threading.Tasks.Extensions.DLL
System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 | C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll | file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
TechTalk.SpecFlow, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\TechTalk.SpecFlow.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/TechTalk.SpecFlow.DLL
TechTalk.SpecFlow.Generator, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\TechTalk.SpecFlow.Generator.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/TechTalk.SpecFlow.Generator.DLL
TechTalk.SpecFlow.Parser, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\TechTalk.SpecFlow.Parser.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/TechTalk.SpecFlow.Parser.DLL
TechTalk.SpecFlow.Utils, Version=3.0.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\TechTalk.SpecFlow.Utils.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/TechTalk.SpecFlow.Utils.DLL
TechTalk.SpecRun.Common, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b | C:\Projects\vNext\src\packages\SpecRun.SpecFlow.3-0-0.3.0.377\build\net471\TechTalk.SpecRun.Common.dll | file:///C:/Projects/vNext/src/packages/SpecRun.SpecFlow.3-0-0.3.0.377/build/net471/TechTalk.SpecRun.Common.DLL
Utf8Json, Version=1.3.7.0, Culture=neutral, PublicKeyToken=8a73d3ba7e392e27 | C:\Projects\vNext\src\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\Utf8Json.dll | file:///C:/Projects/vNext/src/packages/SpecFlow.Tools.MsBuild.Generation.3.0.225/tasks/net471/Utf8Json.DLL
Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullFalseNameMutateCamelCase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | unknown | unknown
Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullFalseNameMutateOriginal, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | unknown | unknown
Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullFalseNameMutateSnakeCase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | unknown | unknown
Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullTrueNameMutateCamelCase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | unknown | unknown
Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullTrueNameMutateOriginal, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | unknown | unknown
Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullTrueNameMutateSnakeCase, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null | unknown | unknown

System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify[T](IJsonFormatterResolver resolver)
   at Utf8Json.JsonSerializer.Deserialize[T](Byte[] bytes, Int32 offset, IJsonFormatterResolver resolver)
   at Gherkin.GherkinDialectProvider.LoadLanguageSettings()
   at Gherkin.GherkinDialectProvider.TryGetDialect(String language, Location location, GherkinDialect& dialect)
   at Gherkin.GherkinDialectProvider.GetDialect(String language, Location location)
   at TechTalk.SpecFlow.Parser.SpecFlowGherkinDialectProvider.GetDialect(String language, Location location)
   at Gherkin.GherkinDialectProvider.<>c__DisplayClass3_0.<.ctor>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Gherkin.GherkinDialectProvider.get_DefaultDialect()
   at Gherkin.TokenMatcher.Reset()
   at Gherkin.Parser`1.Parse(ITokenScanner tokenScanner, ITokenMatcher tokenMatcher)
   at TechTalk.SpecFlow.Parser.SpecFlowGherkinParser.Parse(TextReader featureFileReader, String sourceFilePath)
   at TechTalk.SpecFlow.Generator.TestGenerator.ParseContent(IGherkinParser parser, TextReader contentReader, String sourceFilePath)
   at TechTalk.SpecFlow.Generator.TestGenerator.GenerateTestFileCode(FeatureFileInput featureFileInput)
   at TechTalk.SpecFlow.Generator.TestGenerator.GetGeneratedTestCode(FeatureFileInput featureFileInput)
   at TechTalk.SpecFlow.Generator.TestGenerator.GenerateTestFileWithExceptions(FeatureFileInput featureFileInput, GenerationSettings settings)
   at TechTalk.SpecFlow.Generator.ErrorHandlingTestGenerator.GenerateTestFile(FeatureFileInput featureFileInput, GenerationSettings settings)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].	Project	C:\Projects\vNext\src\Project\Project\AccountManagement.feature		

Steps to Reproduce

@SabotageAndi
Copy link
Contributor

Do you have also the problem, when you compile one of our examples?
They are at https://github.com/techtalk/SpecFlow-Examples or https://github.com/techtalk/SpecFlow.plus.Examples/

@okyrylenko
Copy link
Author

@SabotageAndi getting the same exception when compiling this solution https://github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest

@SabotageAndi
Copy link
Contributor

Ok, that is very strange. Do you have VS2019 to try it to build it the example with it?

@okyrylenko
Copy link
Author

okyrylenko commented Sep 11, 2019

@SabotageAndi I tried in VS2019 Community and it works fine, but VS2017 Professional still throwing the exception

@SabotageAndi
Copy link
Contributor

@okyrylenko I think then something is missing in your VS2017 installation.

@okyrylenko
Copy link
Author

okyrylenko commented Sep 12, 2019

@SabotageAndi I am doing everything that listed here - https://specflow.org/2019/updating-to-specflow-3/ Considering, I am using the same VS as I used with SpecFlow 2 which I had no issue, I suspect SpecFlow 3 broke something. Is there anything missing from this document?

@SabotageAndi
Copy link
Contributor

Not that I know of. I will create a new VS2017 only VM and try it there and report back.

@SabotageAndi
Copy link
Contributor

So I tried it now on a new Azure VM that has only VS2017 installed and it was working.

I exported the installation config. It looks like it's a complete installation (nearly all workloads are installed)
VS2017_Azure.zip

What happens if you try to build your project on the command line with msbuild?

@hernani-fernandes
Copy link

Hello,
I think the issue is the dll inside the package:
SpecFlow.Tools.MsBuild.Generation.3.0.225\tasks\net471\System.Threading.Tasks.Extensions.dll

It was a netstandard reference.

@SylChamber
Copy link

I think I should open a separate issue, but I wanted to pitch in because I also think there are issues with specflow.tools.msbuild.generation. It does not seem to be compatible with older versions of MSBuild.

When I try to use it with VS2015, SpecFlow 3 extension and the specflow 3 nuget, as soon as I add the MSBuild generation package, the project containing SpecFlow features cannot be loaded by VS2015. The same project works fine in VS2019, but in VS2015 I get an error (I'm translating the error from French so it may not be the same in English):

error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.
C:...\mySolution\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\build\SpecFlow.Tools.MsBuild.Generation.props

The issue seems to be the SpecFlow.Tools.MsBuild.Generation.3.0.225\build\SpecFlow.Tools.MsBuild.Generation.props file: here is the Project element:

<Project TreatAsLocalProperty="TaskFolder;TaskAssembly">

Clearly, MSBuild expects an xmlns attribute, which is not there. I gather it's not required by recent versions of MSBuild, but the one in VS2015 does require it. Here is the Project element for my SpecFlow project with the first import, from the MSBuild generation package:

<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\build\SpecFlow.Tools.MsBuild.Generation.props" Condition="Exists('..\packages\SpecFlow.Tools.MsBuild.Generation.3.0.225\build\SpecFlow.Tools.MsBuild.Generation.props')" />

The MSBuild that is used by my VS2015 is version 14, located in C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe.

@SabotageAndi
Copy link
Contributor

@SylChamber You are right. It is not compatible with older MSBuild versions than 15.
See the docs at https://specflow.org/documentation/Generate-Tests-from-MsBuild/ - Second line.

It it not only the xmlns, we also use features that are only available with MSBuild 15. (e.g. ItemGroup Update)

@venkivb4u
Copy link

I am having the same issue after upgrading from specflow 2.x to 3.x
##[error]feature(0,0): Error : Generation error: Message: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

I am using Visual Studio 2017 and .net 4.6.1.

@SylChamber
Copy link

Thanks @SabotageAndi, I missed that part in the doc. I have colleagues that experience instability with SpecFlow v3 extension with SpecFlow nuget v2.4 in VS2019. They are testing moving from VS2015 to VS2019 and SpecFlow is a deal breaker for now. (I rather suspect an issue with the antivirus because the symptom is long freezes and I'm having more general issues with that antivirus config.) But we're outside the scope of the current issue. :) Thanks for the help.

@SabotageAndi
Copy link
Contributor

@SylChamber please open a separate issue. I would be interested in the instability issues you are experience in VS2019.

@miguelmcorreia
Copy link

@SabotageAndi We are still having issues with v3. We have a Framework 4.7.1 project here and it fails in our Build Server, where we do not have/want dotnet core libraries.

[Step 1/1] \packages\SpecFlow.Tools.MsBuild.Generation.3.1.82\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. 
[Step 1/1] \packages\SpecFlow.Tools.MsBuild.Generation.3.1.82\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: System.Exception: Error when reading project file. ---> System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. 

Do you have any idea why this might happen?

@SabotageAndi
Copy link
Contributor

@miguelmcorreia sorry, no idea. My assumption is, that something is not installed. I could not reproduce this issue on all of my machine I have available.

@PromisedJetpacks
Copy link

PromisedJetpacks commented Feb 26, 2020

@miguelmcorreia - I'm also seeing this issue on a new SpecFlow project I've created. The build and execution of tests works fine locally (VS2019 .net framework proj) but our build server (MSBuild15.0) fails with the following:
System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.

Did you discover a workaround?

@Shanson90
Copy link

Shanson90 commented Mar 16, 2020

Similar errors, seemingly out of nowhere in our GitLab build pipeline (Linux runners):

Framework: .Net Core 3.1
SpecFlow Version: 3.1.86
Test Runner: xUnit 3.1.86 (ie SpecFlow.xUnit package)
xUnit Version: 2.4.1

Everything has been working fine, then all of the sudden multiple unrelated branches started failing in our pipelines (even branches that had previously passed). So only logical thing is there was a change to a 3rd party package somewhere or to the runner itself.

Specific error is:

$ dotnet test "$PROJECT_NAME.IntegrationTests" --no-restore --configuration="$CONFIGURATION"
 /root/.nuget/packages/specflow.tools.msbuild.generation/3.1.86/build/SpecFlow.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [/builds/ratemanager/descriptives/descriptives-service/Chatham.Services.RateManager.Descriptives.IntegrationTests/Chatham.Services.RateManager.Descriptives.IntegrationTests.csproj]
 /root/.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.

If this is not close-enough to the original issue reported, I'll happily create an issue. This is just the first thread I've found that seems like it might be the same core issue.

@Jandev
Copy link

Jandev commented Mar 17, 2020

We've did some investigation and found it has something to do with an update in .NET Core which causes Specflow not to run properly anymore (dotnet/core#4404).

We've solved it, short-term, by locking our .NET Core version to 3.1.102

@SabotageAndi
Copy link
Contributor

@Jandev & @Shanson90 I created a separate issue for the .NET Core 3.1.200 SDK problem: #1912

@nvborisenko
Copy link
Contributor

Could not load file or assembly 'netstandard, Version=2.0.0.0

Try to install .Net Core SDK or .Net Core Runtime component.

@nishanthmadala
Copy link

I got the same issue but got resolved, We need to upgrade Windows 10 to version 1703 or Higher version.

@SabotageAndi
Copy link
Contributor

As we stopped maintaining the SpecFlow+ Runner (https://specflow.org/using-specflow/the-retirement-of-specflow-runner/) I am closing this issue.

@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 Feb 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests