AutoMapper轉換到Mapster 並且使用Azure DevOps And CI所發生的問題

System.IO.FileSystem.Primitives from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version

##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1

##[error]Dotnet command failed with non-zero exit code on the following projects 


起源於 我把 AutoMapper 轉換到 Mapster 之後,我原本Azure DevOps CI都是正常的

結果我上版上去之後,就發生錯誤

      D:\a\1\s\src\Notify.Model\Notify.Model.csproj : error NU1605: Detected package downgrade: System.IO.FileSystem.Primitives from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version. [D:\a\1\s\src\Notify.WebApi\Notify.WebApi.csproj]

##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1

##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build

Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting

##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\src\Notify.WebApi\Notify.WebApi.csproj

 

怎麼樣都覺得很奇怪

最後的解決方法就是直接安裝

我的Model專案也有安裝

Microsoft.AspNetCore.Mvc.Core 2.2.5版本

所以最後解決的方式就是

System.IO.FileSystem.Primitives 4.3版本