dotnet / dotnet/core

.NET Core 3.1 Worker Service - Publish with environment variables not working as expected

Open
#4,426 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

I am trying to publish a .NET Core 3.1 Worker Service app using different publish profiles.
I have setup 2 publish profiles, one for Development and one for Production, with very similar settings for both:
```


Development
FileSystem
Release
x64
netcoreapp3.1
D:\Workspace\Tools Publish\Worker
win-x64
true
False
False
False

```
The only difference between the two profiles is the **EnvironmentName** element, which is set to **Development** and **Production**, respectively.

However, setting this element seems to have no effect on the actual output of the publish operation, as starting the app that was published using the **Development** profile (via .exe) will result in the app running under the **Production** hosting environment.

Can anyone help? Am I experiencing some weird issue or is this indeed broken right now?

Note: I am using Visual Studio 2019, I don't know if the IDE could be causing this

(P.S. I have also published some ASP.NET Core 2.1 apps previously and for them the **EnvironmentName** element worked correctly, the publishes producing apps with different configurations depending on the publish profile used)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.