我们已经将项目从.NET移植到.NET Core,以便将AWS管道与需要Linux的Docker容器一起使用。
应用程序在我们的本地计算机(运行 Windows)上成功构建,但在 AWS 管道中,构建步骤显示此错误 -GenerateFeatureFileCodeBehindTask ... task could not be loaded from the assembly ... SpecFlow.Tools.MsBuild.Generation.dll
:
完全错误:
/root/.nuget/packages/specflow.tools.msbuild.generation/3.0.225/build/SpecFlow.Tools.MsBuild.Generation.targets(78,5): error MSB4062: The "SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask" task could not be loaded from the assembly /root/.nuget/packages/specflow.tools.msbuild.generation/3.0.225/build/../tasks/netcoreapp2.0/SpecFlow.Tools.MsBuild.Generation.dll. Assembly with same name is already loaded Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements
Microsoft.Build.Framework.ITask. [/codebuild/output/src814/src/s3/00/ProjectFoo/ProjectFoo.csproj]
我发现了 2 个提到此错误的链接,但没有解决方案 - https://ci.appveyor.com/project/SpecFlow/specflow-kx1o3/build/build1119 和 https://www.gitmemory.com/issue/techtalk/SpecFlow/1699/520196304。
我已经检查过,我的csproj文件中没有<UsingTask>
。知道这个 SpecFlow 任务是什么,以及为什么它会抛出这个错误吗?
GenerateFeatureFileCodeBehindTask
包含在SpecFlow.Tools.MSBuild.Generation
包中。它用于生成功能文件的代码隐藏文件。
找不到<UsingTask>
,因为它是在 NuGet 包中完成的。
GitHub 为此的问题是:https://github.com/techtalk/SpecFlow/issues/1699/目前我不知道为什么会抛出此错误。但是我们目前正在修复Linux的构建/测试。