JSON Variable replacement problem

Hi we currently have problem with variable replacement, current implementation not work with variable name with token :

It there a way to Escaper the character ?
profiles:web:environmentVariables:Hosting:Environment =>
profiles:web:environmentVariables:“Hosting:Environment” or
profiles:web:environmentVariables:Hosting\:Environment

Sample :

Variable
profiles:web:environmentVariables:Hosting:Environment = Acceptance

json launchSettings.json (http://docs.asp.net/en/latest/fundamentals/environments.html)

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:40088/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNET_ENV": "Development"
      }
    },
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "Hosting:Environment": "Staging"
      }
    }
  }
}

Hi Martin,

Thanks for reaching out. Could you show us a mock of how should the expected final JSON look for you? Having a bit of a hard time trying to understand what you need here.

Thanks!
Dalmiro

Exemple

Initial config file

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:40088/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNET_ENV": "Development"
      }
    },
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "Hosting:Environment": "Staging"
      }
    }
  }
}

Expected result after variable replacement (profiles:web:environmentVariables:Hosting:Environment = Acceptance)
check special variable name “Hosting:Environment”

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:40088/",
      "sslPort": 0
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNET_ENV": "Development"
      }
    },
    "web": {
      "commandName": "web",
      "environmentVariables": {
        "Hosting:Environment": "Acceptance"
      }
    }
  }
}

Hi Martin,

Thanks for sharing that info. I believe we should definitely be supporting this scenario, so I’ve created a github issue for it: https://github.com/OctopusDeploy/Issues/issues/2492

On the issue I’ve also mentioned the current workaround (until we fix this issue) which would be using the Substitute Variables in Files feature.

Regards,
Dalmiro