-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I create new Blazor WebAssembly Standalone App template project in Visual Studio 17.12.0 Preview 2.0, targeting .net 9 using the 9.0.100-rc.1.24452.12 version of .net SDK
Then I slightly change the 'Home' page in the 'Pages' folder of the project to display the environment as follows:
@page "/"
@using Microsoft.AspNetCore.Components.WebAssembly.Hosting
@inject IWebAssemblyHostEnvironment Env
<PageTitle>Home</PageTitle>
<h1>Hello, world!</h1>
Welcome to your new app.
<p>Environment: @Env.Environment</p>
Now, when I run the project in VS debug mode, I get this result
indicating, that the project runs as in production environment (not correct IMO), even though the generated launchSettings.json sets the 'ASPNETCORE_ENVIRONMENT' as 'Development'
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7299;http://localhost:5176",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
When I follow the exact steps in the same Visual Studio using the same .net SDK version with the only difference - targeting .net 8 (instead of .net 9) I get this:
The environment is 'Development' which I tend to consider as correct behavior
Expected Behavior
Running Blazor WebAssembly Standalone App project from VS in 'debug' mode with
"ASPNETCORE_ENVIRONMENT": "Development"
set in launchSettings.json
should set the environment to 'Development' instead to 'Production'
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100-rc.1.24452.12
Anything else?
.NET SDK:
Version: 9.0.100-rc.1.24452.12
Commit: 81a714c6d3
Workload version: 9.0.100-manifests.67cd1eb6
MSBuild version: 17.12.0-preview-24422-09+d17ec720d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64