How-to: set up a config transform variable substitution for another process install directory

Hello,

I’m trying to reference the install directory for one of my project processes so that I can use it in another process’s configuration transformation. Below is the example web.Release.config file I’m using, including the reference to the correct process install directory. Any help on this would be greatly appreciated.

Thanks,

Johnathan

<?xml version="1.0" encoding="utf-8"?>

<!-- For more information on using web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add key="SAMWebConfigPath" value="#{Octopus.Action[ProcessName].Output.Package.InstallationDirectoryPath}" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
  </appSettings>
</configuration>

Hi Johnathan,

Thanks for getting in touch! Firstly I’ll point out that I’m not sure I understand your setup exactly, so feel free to correct me if I’ve misunderstood in any way, or to expand as needed. :slight_smile:

You can define absolute paths to transform files that already exist on the target, though absolute paths can’t be used to reference config files. Meaning you’d need at least the web.config file in the package you’re deploying.

To target the transform file, you can define the absolute path in the additional transforms field in the Configuration Transforms section of the package step (e.g. something like C:\Path\web.Release.config => web.config). That example assumes the web.config is in the root of your package.

I hope this helps! Let me know how you go or if you have any further questions moving forward.

Best regards,

Kenny

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.