-
Notifications
You must be signed in to change notification settings - Fork 89
Description
Describe the bug
When using .NET 9's MapStaticAssets
, existing assets in wwroot
are picked up and compressed during build.
However, using Microsoft.Web.LibraryManager.Build
, the libraries installed via libman in wwwroot/lib
are not picked up.
I've tried numerous combinations of adding a target that tries to trigger the LibraryManagerRestore
target before various other targets that sound like they are looking for assets (like ResolveStaticWebAssetsInputs
or ResolveProjectStaticWebAssets
) but none of that seems to work.
To Reproduce
Steps to reproduce the behavior:
- Create a csproj that uses the ASP.NET web SDK with library manager (including
Microsoft.Web.LibraryManager.Build
) and restores libraries using libman intowwwroot/lib
- run
dotnet publish --configuration release --output ./dist
- Check the generated static web assets file in the output (
cat dist/PROJECTNAME.staticwebassets.endpoints.json
) - Find that it does not contain any files that were restored by libman in
wwwroot/lib
Expected behavior
LibMan restored files are included in the static web assets manifest.
Additional context
Note that this is rather hard to reproduce in an IDE, since it will usually automatically restore the libman libraries.
If the wwwroot/lib
folder exists BEFORE the build is started, it is also correctly picked up by the static web assets tooling.
We've hit the problem during CI builds.
dotnet --version
: 9.0.305
Microsoft.Web.LibraryManager.Build
: 3.0.71