Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Errors running libman CLI commands as a pre-build step in projects building in parallel on an Azure hosted agent

Open
#526 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
build-system, cli

Research direction

Start by reproducing the two-project parallel build using the libman clean && libman restore pre-build commands and the Azure Pipelines installation steps. Inspect how concurrent CLI invocations access .librarymanager/libman.config.json; done means both projects build successfully without the file-in-use exception.

Written by the indexing model from the issue text.

Description

Functional impact

Running into errors building projects in parallel on an Azure Pipelines hosted agent when they both invoke the libman CLI as a pre-build step.

Minimal repro steps
  1. Create a Visual Studio solution with 2 projects that both invoke "libman clean && libman restore" as a pre-build step
  2. Create an Azure Pipeline that
    1. Uses a 'dotnet' task to install the libman CLI to Agent.ToolsDirectory
      dotnet tool install Microsoft.Web.LibraryManager.Cli --tool-path="$(Agent.ToolsDirectory)"
    2. Uses a 'Powershell' task that adds Agent.ToolsDirectory to the environment variables
      Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};$(Agent.ToolsDirectory)";
    3. Builds the solution in parallel
  3. Run the build on an Azure hosted agent
Expected result

Libman CLI commands run successfully

Actual result

Sometimes I see the following error output for one of the projects which causes the build to fail:

Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.Web.LibraryManager.Configuration.Settings' threw an exception. ---> System.IO.IOException: The process cannot access the file 'C:\Users\VssAdministrator\.librarymanager\libman.config.json' because it is being used by another process.
Further technical details

I assume the issue is because both commands are running simultaneously and one puts a lock on libman.config.json so the other can't access it. I have run the build on a VM agent and do not see this error, though I installed libman globally on that machine so the 'install Libman CLI' step isn't part of the pipeline that runs on it.

Dominant language
C#
Stars
486
Forks
91
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aspnet/LibraryManager

All issues in aspnet/LibraryManager

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.