WebDeploy w/ ASPNETCORE_ENVIRONMENT

Artur O's Avatar

Artur O

17 Nov, 2021 07:04 PM

Hi,

I am trying to figure out how to set ASPNETCORE_ENVIRONMENT for Webdeploy to create web.config that reflects it.
Currently it will deploy without the environmentVariables element.

I tried to set the:
environment:
ASPNETCORE_ENVIRONMENT: Staging

However it does not seem to pick it up during deploy. Am I missing something?

environment:
  ASPNETCORE_ENVIRONMENT: Staging
deploy:
  - provider: WebDeploy
    server: url
    website: sitename
    username: username
    password:
      secure: password
    artifact: artifact
    app_offline: true
    skip_dirs: '\\App_Data'
    skip_files: license.json
    remove_files: true
    on:
      branch: develop

What I get

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="" verb="" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath="dotnet" arguments=".\args" stdoutLogEnabled="false" hostingModel="InProcess" stdoutLogFile=".\logs\stdout"/>
    </system.webServer>
  </location>
</configuration>
What I want:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="" verb="" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
       <aspNetCore processPath="dotnet" arguments=".\args" stdoutLogEnabled="false" hostingModel="InProcess" stdoutLogFile=".\logs\stdout">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Staging" />
        </environmentVariables>
      </aspNetCore>
    </system.webServer>
  </location>
</configuration>
  1. Support Staff 1 Posted by Feodor Fitsner on 18 Nov, 2021 03:04 AM

    Feodor Fitsner's Avatar

    You should implement Web Deploy parametrization: https://www.appveyor.com/docs/deployment/web-deploy/#web-deploy-par...

  2. Feodor Fitsner closed this discussion on 18 Jan, 2022 09:02 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac