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')
2 Answer(s)
-
0
- The most reliable way to run
abp install-libsin Azure DevOps is to avoid the “first run only installs/updates extensions and restarts the CLI” behavior by explicitly runningabp check-extensionsbeforeabp install-libs, and to ensure the agent has Node.js/npm available on PATH (sinceinstall-libsuses the JS package manager under the hood). - Also, if you’re using a self-hosted Windows agent with a persistent workspace, make the
wwwroot/libscleanup 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:
- No double-run needed:
abp check-extensionsis the supported way to “check/update extensions” up-front, soinstall-libscan do its real job in the next step. - Node is explicitly installed: prevents intermittent “npm not found” / environment PATH inconsistencies (common on self-hosted agents).
- Workspace persistence issues handled: your read-only attribute cleanup avoids
UnauthorizedAccessExceptionwhen deletingwwwroot/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) - The most reliable way to run
-
0
Hi,
Pass
--skip-extension-version-check(or-sevc) toabp install-libs.install-libsdoesn'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 thecontinueOnErrortrick.We'll also add
install-libsto 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)