Fix static assets when running in non prod mode#2346
Open
GarrettBeatty wants to merge 2 commits intodevfrom
Open
Fix static assets when running in non prod mode#2346GarrettBeatty wants to merge 2 commits intodevfrom
GarrettBeatty wants to merge 2 commits intodevfrom
Conversation
1 task
GarrettBeatty
commented
Apr 23, 2026
|
|
||
|
|
||
| <!-- Ensure wwwroot content is copied to output directory --> | ||
| <ItemGroup> |
Collaborator
Author
There was a problem hiding this comment.
the unit tests need this to pass. my guess is dotnet build does not auto copy the wwroot to the output directory.
However when i did the manual testing (as in the pr description), it seems like dotnet pack auto copy everything which is why this change wasn't needed then. But when i ran the tests i had to add in b559dd5
dscpinheiro
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix static assets failing to load when ASPNETCORE_ENVIRONMENT is set to non-Production value
Fixes #2118
Description
When
ASPNETCORE_ENVIRONMENTorDOTNET_ENVIRONMENTis set to anything other thanProduction(e.g.,Development), the Lambda Test Tool's static assets (CSS, JS, BlazorMonaco) fail to load with 404 errors, rendering the web UI completely broken.Root cause: In
TestToolProcess.cs, static file serving was conditional onapp.Environment.IsProduction(). In Production mode, an explicitPhysicalFileProviderpointing toAppContext.BaseDirectory/wwwrootwas used, correctly serving files from the tool's install directory. In non-Production mode, the bareapp.UseStaticFiles()was called instead, which relies on the static web assets manifest (staticwebassets.runtime.json). This manifest contains absolute paths from the build machine (source directories and NuGet cache paths) that don't exist on end-user machines, causing all static asset requests to return 404.Fix: Always use the explicit
PhysicalFileProviderto serve static files from the tool's install directory (AppContext.BaseDirectory/wwwroot), regardless of the environment.UseDeveloperExceptionPage()is still conditionally applied for non-Production environments.Testing
Setup:
Before fix — reproduce the bug:
From a second terminal:
After fix — verify the fix:
From a second terminal:
Baseline — confirm no regression in Production mode: