how to fix dotnet core build issue on new jenkins windows agent server

Raju, Ilaiyaraja 0 Reputation points
2023-11-14T12:11:20.6166667+00:00

Hi Team,
I'm building new jenkins agent on windows 2019 server for dotnet core build .
the dotnet SDKs installed are same as old server which is working fine . but on new server the post build package microsoft.extensions.dependency.model.dll is referring to 2.1.0.0 version which suppose to be with 3.0.19 version. on old server its correctly referring to 3.0.19 version . i dont know why the new server is referring to 2.1.0 version and from where its being referred is unclear.
microsoft.extensions.dependency.model.dll - this dll is getting referred from serilog.settings.configuration reference in csproj file . I have tried adding separate package reference for that dll with 3.0.0 version but still its referring to 2.1.0 version after the build .
But what I observerd is the dll from following path is "Firm.API\bin\Release\net6.0" correctly referring to 3.0.19.** version but why output directory if referring to 2.1.0 version is the issue . I have installed dotnet core 2,3,6 SDKs on the new server . so currently the dotnet.exe is referring to 6.0 version .

Below are the commands we are using for dotnet core build project ,

Command to Restore Nuget dependencies: "C:\Program Files\dotnet\dotnet.exe" -s https://nexus-prod.com/repository/nuget-group/

Build command: "C:\Program Files\dotnet\dotnet.exe" publish --no-restore -c Release -o "D:\jenkins\workspace\firm-merge-dev-to-feature-branch\API"

User's image

Its not working on new jenkins agent only but old agent which is running on 2012 os is working fine .but we need to demise 2012 OS server soon. so please help advise on above issue.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,344 questions
.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
326 questions
0 comments No comments
{count} votes