Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build Fails with "Error:The process '/usr/bin/dotnet' failed with exit code 1" after adding "no-build:true" in the dotnet pack command

The CI pipeline works well if I remove the nobuild:true option from the DotNetCoreCLI@2 task to pack the Project (ie to create a NuGet package) but I am not able to understand what special except not building the project does the nobuild option brings. I need not want to build the Project again as the Previous task have already build the Project and locked the Assembly version of DLLs generated. I want to use the same build to create the NuGet package and to do the same I need to pass the NoBuild option but doing the same breaks the pipeline.

The pipeline gives the error that the DLLs to be packed are not present at the specified location but I tried to look at the location and I could find the DLLs.One thing that confuses me is that though I have given nobuild to be true but still the tasks shows as Building the Project.

- task: DotNetCoreCLI@2
  displayName: ".NET pack"
  inputs:
    command: pack
    packagesToPack: ${{ parameters.packagesToPack }}
    nobuild: true
    versioningScheme: byEnvVar
    versionEnvVar: CI_Version
    packDirectory: $(build.artifactStagingDirectory)\${{ parameters.packTo }}
    verbosityPack: 'Normal'

Error:

Its also important to note that the same thing( nobuild:true) works on Windows Agent but it fails on Ubuntu Agent.

PS: It could be a case where windows has upgraded the agent and has caused the issue. I searched over the issue and found that one has to lock the .net SDK in the build pipeline

like image 895
Shubhanshu Rastogi Avatar asked Oct 14 '25 14:10

Shubhanshu Rastogi


1 Answers

Thanks for the other answers that may be related to the issue but things were already taken care.

The issue was only on the Linux Environment because of an issue in .NET SDK. Refer here

The error(DLLs could not be found in the path specified ) that was being generated was correct in somehow but also it was misleading. The DLLs were being generated in Release folder at the build stage and when I was packing the DLLs they were being searched in release folder. Though Release and release remains the same in Windows Environment but Ubuntu being case sensitive generates the Error.

The SDK implementation of .Net Core missed the IgnoreCase in the Regex option and that caused the build to break on switchin to a Linux Agent.

DotnetBuild: enter image description here

Dotnet Pack: enter image description here

Solution: Define the folder where to generate the DLLs in the .csproj and the automatically build and pack step would pick the DLLs from there.

like image 142
Shubhanshu Rastogi Avatar answered Oct 18 '25 01:10

Shubhanshu Rastogi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!