我们的TeamCity服务器无法为.NET Core项目运行SpecFlow 3测试。
我的家庭和工作工作站都可以运行这些测试。
似乎在创建ASP.NET Core内存中TestServer Web服务器实例的过程中,所有类型都被枚举为DI容器设置的一部分。
无法加载文件或程序集'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)
搜索我的工作站,我可以找到以下匹配的程序集。
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
我的测试项目引用了这些东西。注意,SpecRun.Runner
是上面tools
中缺少程序集的软件包。嗯...
<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">
我会继续努力,并会向您报告。
我从Git跟踪中删除了feature.cs
个文件,因此我正在研究这些文件仍在构建服务器上,而不是清理掉的想法。
其他查询词:ci cd管道
答案 0 :(得分:0)
您的问题已在本文档中解决:
https://www.thetopsites.net/article/54438056.shtml
您需要执行的操作是删除其中一个运行程序,即SpecRun,然后添加Specflow.Tools.MSbuild.Generation
NuGet软件包,这将解决您的问题。