dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.56k stars 25.31k forks source link

Is it possible to change environment variable for web.config during Web deploy? #10513

Closed neman closed 5 years ago

neman commented 5 years ago

I'm publishing app using Web Deploy (VS Project right click -> publish -> web deploy publish profile) Can you please add instructions how to Set environment variables for web.config during web deploy?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

guardrex commented 5 years ago

Hello @neman ... Thanks for asking. When the engineers were discussing it (around this point in the convo) with the community on the engineering repo, they didn't open a docs issue at that time. So, let's ask now.

btw --- Just to recap for the environment ONLY: In the Web Deploy profile (pubxml), provide the following ...

<EnvironmentName>YourCustomEnvironment</EnvironmentName>

... or to use an MSBuild property, use $(EnvironmentName) within the project file.

WRT env vars broadly via transforms ... @vijayrkn ...

Is vijayrkn/webconfigtransform officially supported for 2.2?

There's also a fair amount of ❤️ out there for nil4/dotnet-transform-xdt, and the features might not exactly match vijayrkn/webconfigtransform ... probably worth taking a look at if vijayrkn/webconfigtransform doesn't fit your scenario.

Going back to <EnvironmentName> and $(EnvironmentName), let's surface in the following locations where appropriate:

I'll work that separately (on a new issue that I'll open) from the broader case that you're asking about if we end up using this issue to document vijayrkn/webconfigtransform.

Cross-ref:

vijayrkn commented 5 years ago

Is vijayrkn/webconfigtransform officially supported for 2.2?

Yes, the web.config transform support is officially supported for 2.2. Also this should have all the support similar to the global tool.

guardrex commented 5 years ago

Thanks @vijayrkn ... I'll work it on this issue and see about getting it done on the next sprint.

I'll piggyback <EnvironmentName> and $(EnvironmentName) on an existing issue (aspnet/Docs #10165) that deals with env var coverage.