LibraryManager icon indicating copy to clipboard operation
LibraryManager copied to clipboard

Building solution with --runtime fails with error LIB003

Open rlaveycal opened this issue 5 years ago • 7 comments

Functional impact

Build fails in CI server

Minimal repro steps

I have a build pipeline that runs each step in the nano sdk container on Windows 2019 (microsoft/dotnet:2.2.103-sdk-nanoserver-1809). The source code folder is mapped into the container as a volume.

My solution contains a web project, a couple of support projects and a couple of test projects that depend on the web project

  1. dotnet restore my.sln --configuration release --runtime win-x64
  2. dotnet build my.sln --configuration release --runtime win-x64 --no-restore

Step 2 fails with multiple instances of error LIB003, each for a different file. The files in question are present

libman.json : error LIB003: css/bootstrap-grid.min.css.map could not be written to disk. Make sure the file name is correct

Expected result

The build would work

Further technical details

  • Running a LibMan CLI step before the build to restore the packages doesn't solve the issue
  • Removing the --runtime win-x64 option works.
  • Doing the build on the web project works.

My guess is that there's a race condition between concurrent downloads of the packages caused by builds of the test projects. When --runtime is specified the output shows 2 instances of

  Restoring library [email protected]...
  Restoring library [email protected]...
  Restoring library [email protected]...
  Restoring library [email protected]...
  Restoring library [email protected]...

  5 libraries restored in 0.18 seconds

whereas without it only 1 restore is done.

rlaveycal avatar Jun 11 '19 11:06 rlaveycal

Same issue on v2.1.76. Is there any workaround?

Nimatora avatar May 15 '20 16:05 Nimatora

I am having a similar issue; I dont have the runtime options, but the project does have them in the proj like this ;

<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>

I get this error; pretty consistently

libman.json : error LIB003: highstock.src.js could not be written to disk. Make sure the file name is correct 

on version 2.1.161, but had it on earlier versions too.

Jetski5822 avatar Apr 28 '22 08:04 Jetski5822

We are experiencing this sporadically as well. Is there any update?

AlexanderSchulz-Siemens avatar May 09 '23 16:05 AlexanderSchulz-Siemens

I would also like to tack onto this issue. I am seeing it while restoring a net6.0 asp.net web app in a docker container.

It's important to note that while the web app doesn't have multiple runtimes, and I wasn't using the CLI options to specify one, the app did use some legacy packages in .Net Framework. I had been using the dotnet core docker image as my build, so I tried using a framework image instead to see if that helped - and it did! So for anyone stuck on this, I might recommend trying a Framework container and see if it helps, especially if you have legacy/old Nuget packages that run in Framework (even if your web app is dotnet core)

cidthecoatrack avatar Aug 16 '23 14:08 cidthecoatrack

I still have the same error, I have tried a few ways to fix it but it's still unclear, when I open the project it crashes I did clean a few times and it disappeared. <PackageReference Include="Microsoft.Web.LibraryManager.Build" Version="2.1.175" />

image

Hoai-Phong avatar Sep 13 '23 03:09 Hoai-Phong

@Hoai-Phong can you share the libman.json snippet for that library so I can try to reproduce the issue?

jimmylewis avatar Sep 13 '23 03:09 jimmylewis

@jimmylewis Send you { "version": "1.0", "defaultProvider": "cdnjs", "libraries": [ { "library": "[email protected]", "destination": "wwwroot/lib/jquery/", "files": [ "jquery.min.js", "jquery.js" ] }, { "provider": "cdnjs", "library": "[email protected]", "destination": "wwwroot/lib/bootstrap/", "files": [ "js/bootstrap.min.js", "js/bootstrap.js" ] }, { "provider": "unpkg", "library": "[email protected]", "destination": "wwwroot/lib/datatables.net-bs5/", "files": [ "css/dataTables.bootstrap5.css", "css/dataTables.bootstrap5.min.css", "js/dataTables.bootstrap5.js", "js/dataTables.bootstrap5.min.js" ] },

{
  "provider": "unpkg",
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables.net-buttons-bs5/",
  "files": [
    "css/buttons.bootstrap5.css",
    "css/buttons.bootstrap5.min.css",
    "js/buttons.bootstrap5.js",
    "js/buttons.bootstrap5.min.js",
    "js/buttons.bootstrap5.mjs"

  ]
},
{
  "provider": "unpkg",
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables.net-responsive-bs5/",
  "files": [
    "css/responsive.bootstrap5.css",
    "css/responsive.bootstrap5.min.css",
    "js/responsive.bootstrap5.js",
    "js/responsive.bootstrap5.min.js",
    "js/responsive.bootstrap5.mjs"

  ]
},
{
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables-responsive/"
},
{
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables.net-select/",
  "files": [
    "dataTables.select.js"
  ]
},
{
  "library": "[email protected]",
  "destination": "wwwroot/lib/jquery-timepicker/"
},
{
  "library": "[email protected]",
  "destination": "wwwroot/lib/moment.js/"
},

{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/i18next/",
  "files": [
    "i18next.min.js",
    "i18next.js"
  ]
},
{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/select2/",
  "files": [
    "js/select2.min.js",
    "js/select2.js"
  ]
},
{
  "provider": "unpkg",
  "library": "[email protected]",
  "destination": "wwwroot/lib/jquery-datatables-checkboxes/",
  "files": [
    "css/dataTables.checkboxes.css",
    "js/dataTables.checkboxes.js",
    "js/dataTables.checkboxes.min.js"
  ]
},
{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/select2/"
},
{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/flatpickr/"
},
{
  "provider": "unpkg",
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables.net/",
  "files": [
    "js/jquery.dataTables.js",
    "js/jquery.dataTables.min.js"
  ]
},

{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables-buttons/",
  "files": [
    "js/dataTables.buttons.min.js",
    "js/dataTables.buttons.js",
    "js/buttons.print.mjs",
    "js/buttons.print.min.mjs",
    "js/buttons.print.min.js",
    "js/buttons.print.js",
    "js/buttons.html5.mjs",
    "js/buttons.html5.min.mjs",
    "js/buttons.html5.min.js",
    "js/buttons.html5.js"
  ]
},

{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/sweetalert2/"
},
{
  "provider": "cdnjs",
  "library": "[email protected]",
  "destination": "wwwroot/lib/datatables.net-scroller-bs5/",
  "files": [
    "scroller.bootstrap5.min.js",
    "scroller.bootstrap5.css",
    "scroller.bootstrap5.js",
    "scroller.bootstrap5.min.css"
  ]
},
{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-alignment/",
  "files": [
    "src/alignment.js",
    "build/alignment.js",
    "build/translations/ja.js"
  ]
},
{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-alignment/",
  "files": [
    "src/alignment.js",
    "build/alignment.js",
    "build/translations/ja.js"
  ]
},

{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-basic-styles/",
  "files": [
    "build/basic-styles.js",
    "build/translations/ja.js"
  ]
},
{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-editor-classic/",
  "files": [
    "build/editor-classic.js"
  ]
},
{
  "provider": "unpkg",
  "library": "[email protected]",
  "destination": "wwwroot/lib/ckeditor5/",
  "files": [
    "build/ckeditor5-dll.js",
    "build/translations/ja.js"
  ]
},
{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-font/",
  "files": [
    "build/font.js",
    "build/translations/ja.js"
  ]
},
{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-link/",
  "files": [
    "build/link.js",
    "build/translations/ja.js"
  ]
},
{
  "provider": "unpkg",
  "library": "@ckeditor/[email protected]",
  "destination": "wwwroot/lib/ckeditor/ckeditor5-style/",
  "files": [
    "build/style.js",
    "build/translations/ja.js"
  ]
}

, { "provider": "unpkg", "library": "@ckeditor/[email protected]", "destination": "wwwroot/lib/ckeditor/ckeditor5-build-classic/", "files": [ "build/ckeditor.js", "build/translations/ja.js" ] } , { "provider": "unpkg", "library": "@ckeditor/[email protected]", "destination": "wwwroot/lib/ckeditor/ckeditor5-heading/", "files": [ "build/heading.js", "build/translations/ja.js" ] } , { "provider": "unpkg", "library": "@ckeditor/[email protected]", "destination": "wwwroot/lib/ckeditor/ckeditor5-block-quote/", "files": [ "build/block-quote.js", "build/translations/ja.js" ] } ] }

Hoai-Phong avatar Sep 14 '23 06:09 Hoai-Phong