Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
424 views
in Technique[技术] by (71.8m points)

Azure Devops can't run .NET Framework and dotnet core unit test in the same CI task

I have a solution with .NET framework / .NET Core projects.

  • library.csproj (.net standard)
  • library.UnitTests.csproj (.net framework)
  • WebApi.csproj (.net core)
  • WebApi.UnitTests.csproj (.net core)

And I have a CI build via AzureDevops to export coverage on SonarQube.

So, after running, I got this error :

Test run will use DLL(s) built for framework .NETFramework,Version=v4.0 and platform X64
Following DLL(s) do not match framework/platform settings.
WebApi.UnitTests.dll is built for Framework 2.2 and Platform AnyCPU.

I tried to split pipeline into two steps then it works, but i lost the fist step code coverage.(Can't do much things related to sonarQube).

Any idea to run tests together in the same task? Or any another way to do that?

question from:https://stackoverflow.com/questions/65942552/azure-devops-cant-run-net-framework-and-dotnet-core-unit-test-in-the-same-ci-t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The reason for this problem may be that the UnitTests.dll in your project is built for Framework 2.2 and Platform AnyCPU, but in the UnitTest task, Framework 4.0 and Platform x64 is used. You can add a /Framework parameter to solve this question.

/Framework:.NETCoreApp,Version=v2.0

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...