MSBuild Not working in Jenkins But It is working in My Local Command Prompt

Hi, I am Trying to build a CI Pipeline

At Build Step This is the error I am getting when I build through Jenkins " C:\ProgramFiles\dotnet\sdk\5.0.405\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1004: Assets file ‘C:\ProgramData\Jenkins.jenkins\workspace\DevOpsAPI\src\TimeTracker.DAL\obj\project.assets.json’ not found. Run a NuGet package restore to generate this file. [C:\ProgramData\Jenkins.jenkins\workspace\DevOpsAPI\src\TimeTracker.DAL\TimeTracker.DAL.csproj] "

When I am using “dotnet restore” in command prompt to fix this “error NETSDK1004” it is working but if same command “dotnet restore or MSBuild /t:restore or /t:Restore” giving in Jenkins its displaying “MSBUILD : error MSB1008: Only one project can be specified.”

But In command prompt “dotnet build” command it is working

Please provide me solution to fix this Issue !!!

Hi there,

“it doesn’t work” is always hard to remote debug. Try to always include these 3 things.

  1. what did you try? (Code samples, command lines, screenshots, videos, etc)
  2. what did happen? (Error messages, description, outputs, stuff)
  3. what did you expect to happen?

Otherwise, it’s hard for us to get into your context and you’ll have to have someone who is exactly knowledgeable come along.

Please See This Screen Recording
" Loom | Free Screen & Video Recording Software "

This is the screen recording

I am trying to build my DOTNET PROJECT WHICH IS IN GITLAB
Project was cloning correctly from GitLab to my WorkSpace. But After Build I should get “.DLL” Files
but in Jenkins its displaying an Error But if i execute in the command prompt build was a success and .DLL Files are generating

My Expectation is When I click on Build in Jenkins build should be success and “.DLL” Files should be generated

Did you find the solution?