Open Closed

issues with abp install-libs on Azure Devops #10744


User avatar
0
brauerj@gc.adventist.org created

Claude is making a REAL mess trying to get abp install-libs to run reliably on Azure DevOps. I get various errors. Can you share with me the CORRECT reliable way to get this to work?

Current MESS grr

# Cache the ABP Studio CLI extension so it is not re-downloaded from NuGet on
# every run. The cache key includes the OS and the extension version so the
# cache is automatically invalidated when abpStudioVersion is bumped.
- task: Cache@2
  displayName: 'Cache ABP Studio extensions'
  inputs:
    key: 'abp-extensions | "$(Agent.OS)" | "$(abpStudioVersion)"'
    path: 'C:\Windows\ServiceProfiles\NetworkService\.nuget\packages\volo.abp.studio.extensions.standardsolutiontemplates'
    cacheHitVar: ABP_EXT_CACHE_HIT

# install-libs' first action is to wipe each project's wwwroot/libs/ folder. On
# this self-hosted agent the working tree persists between runs and some lib files
# (e.g. flag-icon-css svgs in VelvetAbpDemo) end up read-only, so install-libs'
# own delete fails with UnauthorizedAccessException. Clear read-only attributes
# and force-remove the libs folders ourselves first so install-libs can rewrite.
- powershell: |
    Get-ChildItem -Path "$(Build.SourcesDirectory)" -Recurse -Directory -Filter 'libs' -ErrorAction SilentlyContinue |
      Where-Object { $_.FullName -like '*\wwwroot\libs' } |
      ForEach-Object {
        Write-Host "Force-cleaning $($_.FullName)"
        Get-ChildItem -LiteralPath $_.FullName -Recurse -Force -ErrorAction SilentlyContinue |
          ForEach-Object { try { $_.Attributes = 'Normal' } catch {} }
        Remove-Item -LiteralPath $_.FullName -Recurse -Force -ErrorAction SilentlyContinue
      }
  displayName: 'Force-clean wwwroot/libs (clear read-only before install-libs)'

# On a cold extension cache, the 1st run only downloads the Studio CLI extension
# and restarts the CLI, ending the step with exit code 0 WITHOUT installing libs.
# The libs (e.g. @popperjs/popper.min.js) are then never populated, breaking the
# static web asset build. So when the extension cache was a MISS, run install-libs
# a 2nd time to do the real work after the restart. On a cache HIT no restart
# happens and the 1st run completes the install, so the 2nd run is skipped.
- script: abp install-libs
  displayName: 'abp install-libs (1st run: may only download extensions & restart CLI)'
  continueOnError: 'true'

- script: abp install-libs
  displayName: 'abp install-libs (run again if extension cache was cold / CLI restarted)'
  condition: ne(variables.ABP_EXT_CACHE_HIT, 'true')
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The most reliable way to run abp install-libs in Azure DevOps is to avoid the “first run only installs/updates extensions and restarts the CLI” behavior by explicitly running abp check-extensions before abp install-libs, and to ensure the agent has Node.js/npm available on PATH (since install-libs uses the JS package manager under the hood).
    • Also, if you’re using a self-hosted Windows agent with a persistent workspace, make the wwwroot/libs cleanup deterministic (your read-only cleanup approach is fine), or simply wipe the repo folder each build.

    Use a pipeline structure like this (Windows example), replacing Node version as needed:

    steps:
    # Ensure Node/npm exist (required by install-libs)
    - task: NodeTool@0
      displayName: 'Use Node.js'
      inputs:
        versionSpec: '18.x'   # pick a stable LTS for reproducibility
    
    # (Optional but recommended on self-hosted agents) deterministic cleanup
    - powershell: |
        Get-ChildItem -Path "$(Build.SourcesDirectory)" -Recurse -Directory -Filter 'libs' -ErrorAction SilentlyContinue |
          Where-Object { $_.FullName -like '*\wwwroot\libs' } |
          ForEach-Object {
            Write-Host "Force-cleaning $($_.FullName)"
            Get-ChildItem -LiteralPath $_.FullName -Recurse -Force -ErrorAction SilentlyContinue |
              ForEach-Object { try { $_.Attributes = 'Normal' } catch {} }
            Remove-Item -LiteralPath $_.FullName -Recurse -Force -ErrorAction SilentlyContinue
          }
      displayName: 'Force-clean wwwroot/libs'
    
    # Make CLI extension state stable BEFORE install-libs
    - script: |
        abp check-extensions
      displayName: 'abp check-extensions'
    
    # Now install libs once (no “run twice” workaround needed)
    - script: |
        abp install-libs
      displayName: 'abp install-libs'
    

    Key points this fixes vs. your current YAML:

    1. No double-run needed: abp check-extensions is the supported way to “check/update extensions” up-front, so install-libs can do its real job in the next step.
    2. Node is explicitly installed: prevents intermittent “npm not found” / environment PATH inconsistencies (common on self-hosted agents).
    3. Workspace persistence issues handled: your read-only attribute cleanup avoids UnauthorizedAccessException when deleting wwwroot/libs.

    Sources

    • https://abp.io/docs/10.2/cli/
    • https://abp.io/docs/10.2/framework/ui/mvc-razor-pages/client-side-package-management
    • https://abp.io/docs/10.2/cli/differences-between-old-and-new-cli
    • https://abp.io/docs/latest/cli/index

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    Pass --skip-extension-version-check (or -sevc) to abp install-libs. install-libs doesn't use the Studio extensions at all, so the auto-update/respawn path can be safely skipped and the step will run synchronously without the second run or the continueOnError trick.

    We'll also add install-libs to the auto-skip list in the next CLI release, so the flag won't be needed.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 24, 2026, 12:09
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.