Hi,
We use VS publish option to deploy to multiple environments ( Dev, Preview and Prod), so i added below commands in project.json file to set ASPNETCORE_ENVIRONMENT value dynamically in the web server as part of publish script. (This was setting environmental variable located in appsettings part of my web.config on my website in IIS). I was doing this to avoid a manual job of setting this ASPNETCORE_ENVIRONMENT variable in each deployment server
Things were working fine with RC2 libraries but it started failing with latest 1.0 libraries.
After analysis, i figured out that there was a environmentalvariables element in system.webServer/aspNetCore section of web.config in IIS (Accessed through ConfigurationEditor) and that was not set and hence our code was failing when we check Environment.IsDevelopemnt() function.
What is the command that i can use in project.json to set environmental variable (ASPNETCORE_Environment) in that path while publishing?

Project.Json: (Snippet)
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"commands": {
"Development": "Microsoft.AspNet.Server.Kestrel --ASPNETCORE_ENVIRONMENT Development",
"Preview": "Microsoft.AspNet.Server.Kestrel --ASPNETCORE_ENVIRONMENT Preview",
"Production": "Microsoft.AspNet.Server.Kestrel --ASPNETCORE_ENVIRONMENT Production"
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
Thanks,
Hi,
We use VS publish option to deploy to multiple environments ( Dev, Preview and Prod), so i added below commands in project.json file to set ASPNETCORE_ENVIRONMENT value dynamically in the web server as part of publish script. (This was setting environmental variable located in appsettings part of my web.config on my website in IIS). I was doing this to avoid a manual job of setting this ASPNETCORE_ENVIRONMENT variable in each deployment server
Things were working fine with RC2 libraries but it started failing with latest 1.0 libraries.
After analysis, i figured out that there was a environmentalvariables element in system.webServer/aspNetCore section of web.config in IIS (Accessed through ConfigurationEditor) and that was not set and hence our code was failing when we check Environment.IsDevelopemnt() function.
What is the command that i can use in project.json to set environmental variable (ASPNETCORE_Environment) in that path while publishing?
Project.Json: (Snippet)
Thanks,