Our TeamCity server cannot run the SpecFlow 3 tests for a .NET Core project.

My home and work workstations are able to run these tests.

It seems that during the creation of the ASP.NET Core in-memory TestServer web server instance, all the types are being enumerated as part of the DI container setup.

Could not load file or assembly 'TechTalk.SpecRun...

System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types.
Could not load file or assembly 'TechTalk.SpecRun, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b'. The system cannot find the file specified.
Could not load file or assembly 'TechTalk.SpecRun.Common, Version=3.0.0.0, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b'. The system cannot find the file specified.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeAssembly.get_DefinedTypes()
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
...
// Abridged here
...
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.Initialize()
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
   at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder, IFeatureCollection featureCollection)

Searching my workstation I can find the following matching assembly.

FullName
--------
C:\Users\luke.puplett\.nuget\packages\specrun.runner\3.0.337\tools\net45\TechTalk.SpecRun.dll
C:\Users\luke.puplett\.nuget\packages\specrun.runner\3.0.337\tools\netcoreapp2.0\TechTalk.SpecRun.dll
C:\Users\luke.puplett\.nuget\packages\specrun.runner\3.0.337\tools\netcoreapp2.1\TechTalk.SpecRun.dll
C:\Users\luke.puplett\.nuget\packages\specrun.runner\3.0.337\tools\netcoreapp2.2\TechTalk.SpecRun.dll

My test project references this stuff. Note, SpecRun.Runner is the package that has the missing assembly though it is in tools above. Hmm...

    <PackageReference Include="SpecFlow" Version="3.0.199" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.0.199" />
    <PackageReference Include="SpecFlow.xUnit" Version="3.0.199" />
    <PackageReference Include="SpecRun.Runner" Version="3.0.337" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">

I'll keep struggling on and will report back.

I removed the feature.cs files from Git tracking so I'm looking into the idea that these files are still on the build server, not cleaned out.

Additional query words: ci cicd pipeline

0 Answers