aspnetcore: The path must be absolute. (Parameter 'root')
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
The path must be absolute. (Parameter ‘root’)
Expected Behavior
Upgrading vs before is good
Steps To Reproduce
Docker version 26.1.4, build 5650f9b Docker Desktop 4.31.1
Exceptions (if any)
在 Microsoft.Extensions.FileProviders.PhysicalFileProvider…ctor(String root, ExclusionFilters filters)
在 Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.<>c.<UseStaticWebAssetsCore>b__1_0(String contentRoot)
在 Microsoft.AspNetCore.StaticWebAssets.ManifestStaticWebAssetFileProvider…ctor(StaticWebAssetManifest manifest, Func2 fileProviderFactory) 在 Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssetsCore(IWebHostEnvironment environment, Stream manifest) 在 Microsoft.AspNetCore.Hosting.StaticWebAssets.StaticWebAssetsLoader.UseStaticWebAssets(IWebHostEnvironment environment, IConfiguration configuration) 在 Microsoft.AspNetCore.Hosting.BootstrapHostBuilder.RunDefaultCallbacks() 在 Microsoft.AspNetCore.Builder.WebApplicationBuilder.InitializeHosting(BootstrapHostBuilder bootstrapHostBuilder) 在 Microsoft.AspNetCore.Builder.WebApplicationBuilder..ctor(WebApplicationOptions options, Action1 configureDefaults)
在 Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(String[] args)
在 HY.Web.Program.Main(String[] args) 在 C:\projects\XYZ.Web\Program.cs 中: 第 41 行
.NET Version
8.0.300
Anything else?
VS17.10.2
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 15 (3 by maintainers)
I encountered the same issue when deploying my application to Azure on Ubuntu. The issue occurs when I set the ASPNETCORE_ENVIRONMENT environment variable to Development, as shown in the
When I switch the environment variable to Production, it works properly.

Microsoft Visual Studio Enterprise 2022 (64-bit) - Current Version 17.11.1 dotnet version 8
We see the same issue in our project. When running Visual Studio v17.10.x we get the “Path must be absolute” error:
For us it seems that rolling back to Visual Studio v17.8 mitigates the issue.
We are also running a containerized app using dotnet 6, using the WSL2 based engine.
Unfortunately I can’t share our solution publicly, but I’ll try to create a minimal project to reproduce the issue.
Where is the fix? Really one year?
And another update - try to change the webRoot folder to something else, not wwwroot. As far, as I understood - there’s some sort of VS magic, that reacts to wwwroot folder inside the project folder - VS thinks, that this folder should be copied to output no matter what and generates those staticwebassets.runtime.json files with incorrect references. Then, during WebHost.CreateDefaultBuilder it tries to resolve StaticFilesManifest -> looks for those staticwebassets.runtime.json files and sets the WebRoot to the value from those files. In Production it is not triggered, since this code is executed only in Development.