Vladimir Rodchenko Vladimir Rodchenko - 3 months ago 12
ASP.NET (C#) Question

aspnetcore rc2 Local.pubxml How to setup environment during publishing?

I'm trying to publish my aspnetcore rc2 website using Local.pubxml to IIS.

The problem is that I want to change the environment so that I can use

env.IsDevelopment()
and other nice features.

For now, I don't know how to change ASPNETCORE_ENVIRONMENT for:


  1. Local.pubxml - Development environment

  2. Test.pubxml - Staging environment

  3. Live.pubxml - Production environment



Is that possible?

Answer

The Asp.Net core doc says :

ASP.NET Core references a particular environment variable, Hosting:Environment (or Hosting__Environment on *nix systems), to describe the environment the application is currently running in. This variable can be set to any value you like, but three values are used by convention: Development, Staging, and Production. You will find these values used in the samples and templates provided with ASP.NET Core.

You setup your environment by envar, that's it. There is no .pubxml support.