Wie kann ich in einer XML-Konfigurationsdatei die in Octopus integrierten Variablennamen angeben?

Wir testen Octopus Deploy, also haben wir eine web.config-Beispieldatei erstellt, die wir installiert und in verschiedenen Umgebungen transformiert haben. Die web.config-Transformation und die Verwendung von benutzerdefinierten Variablen funktionieren einwandfrei, aber ich kann keine eingebauten Octopus-Variablen ersetzen. Hier ist ein Beispiel für einen XML-Abschnitt in web.config:

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="environmentTransform" value="" />
    <add key="EnvironmentVariable1" value="$OctopusEnvironmentName" />
    <add key="EnvironmentVariable2" value="$(OctopusEnvironmentName)" />
    <add key="EnvironmentVariable3" value="$(Octopus.Environment.Name)" />
    <add key="EnvironmentVariable4" value="$Octopus.Environment.Name)" />
    <add key="EnvironmentVariable5" value="$OctopusParameters[&quot;Octopus.Environment.Name&quot;]" />
    <add key="MachineVariable1" value="$Octopus.Machine.Name" />
    <add key="MachineVariable2" value="#(Octopus.Machine.Name)" />
    <add key="MachineVariable3" value="#OctopusMachineName" />
    <add key="CustomVariable" value="CustomVariable" />
  </appSettings>

Und hier ist web.Dev.config, benannt nach der Umgebung:

  <appSettings>
    <add key="environmentTransform" value="Dev" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
  </appSettings>

Und hier ist das Ergebnis:

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="environmentTransform" value="Dev" />
    <add key="EnvironmentVariable1" value="$OctopusEnvironmentName" />
    <add key="EnvironmentVariable2" value="$(OctopusEnvironmentName)" />
    <add key="EnvironmentVariable3" value="$(Octopus.Environment.Name)" />
    <add key="EnvironmentVariable4" value="$Octopus.Environment.Name)" />
    <add key="EnvironmentVariable5" value="$OctopusParameters[&quot;Octopus.Environment.Name&quot;]" />
    <add key="MachineVariable1" value="$Octopus.Machine.Name" />
    <add key="MachineVariable2" value="#(Octopus.Machine.Name)" />
    <add key="MachineVariable3" value="#OctopusMachineName" />
    <add key="CustomVariable" value="Value for maeaint01" />
  </appSettings>

Wie Sie sehen, werden Octopus-Variablen nicht ersetzt. Irgendeine Idee warum?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage