Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment isn't respected in Angular SPA template #16935

Closed
ajaybhargavb opened this issue Nov 8, 2019 · 2 comments
Labels

Comments

@ajaybhargavb
Copy link
Member

@ajaybhargavb ajaybhargavb commented Nov 8, 2019

Describe the bug

Running Angular spa template with dotnet run -c Release still runs the app in development mode

To Reproduce

  • dotnet new angular
  • dotnet run -c Release

Expected

  • The app runs in production mode

Actual

  • The hosting environment is still set to development

Note: It works fine when publishing and running with dotnet publish -c Release

Sdk version 3.0.100

@ryanbrandenburg, please add more details if I missed anything

@ryanbrandenburg

This comment has been minimized.

Copy link
Member

@ryanbrandenburg ryanbrandenburg commented Nov 9, 2019

So, it doesn't respect it because of https://github.com/aspnet/AspNetCore/blob/master/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Properties/launchSettings.json#L31, but if you remove that line then you have the problem that running dotnet run -c Release doesn't actually work, it demands that you do dotnet publich -c Release and then run the exe. That's not an ideal experience, but it might not be a small change to fix, and no customers have complained yet.

@javiercn

This comment has been minimized.

Copy link
Member

@javiercn javiercn commented Nov 11, 2019

release/debug != production/development. They are orthogonal.

The reason this happens is because you are doing "dotnet run" and that picks up the environment from launchSettings.json, that behavior is expected.

You can run your "Release" app in "Development" and your "Debug" app in "Production".

@javiercn javiercn closed this Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.