Configuration Variables step doesn't find .config files installed in Pre-deployment script

Hi,

I have a Deploy Package step that deploys a package that contains just a single .msi file. This is a WPF application and we want to use .msi so it gets added to the start menu and is listed in Add/Remove programs (for web applications or windows services, we don’t use installers).

I added the Custom Deployment Scripts and Configuration Variables features. In the Pre-deployment script, I use PowerShell to uninstall the previous version of the program and install the new version. I install the new version into the Package Installation Directory [Octopus.Action.Package.InstallationDirectoryPath]. The Package Installation Directory now contains my .msi file and all my program files, including the [MyProgram] executable and the [MyProgram].exe.config file. I run this step in the Pre-deployment step because it is run “before any configuration changes are made”.

Then, I would expect the Configuration Variables to find the exe.config file and do appSettings and connectionString replacements but it does not. I’m thinking that because this config file isn’t present in the original package, it doesn’t accept it. But I couldn’t find any documentation about this specifically. My expectation is that Configuration Variables should run on any .config file in the Package Installation Directory regardless if it was extracted there from the package or installed there via .msi.

What do you guys think? Is this a bug?

Thanks!
Kelly

Hi Kelly,

Thanks for getting in touch! Are you able to provide a full deployment log with variable evaluation enabled, it will give me an accurate idea of the timeline of events that happen during this deployment.
https://octopus.com/docs/how-to/how-to-turn-on-variable-logging-and-export-the-task-log

Thanks!
Vanessa

Thanks Vanessa, I think I figured out what the problem was. Turning on variable logging helped me see what was going on. I didn’t know about that feature, it is great!

I was starting the msiexec.exe process but not waiting for it to finish in my powershell script. Therefore, the script exited before msiexec finished and the variable replacements ran before the app.config file was laid down by the installer. I fixed this and now everything works as expected. The problem was on my end and this discussion can be closed.

Thanks!
Kelly

Hi Kelly,

Happy to help! That feature is invaluable to us as we can see the events as they occur and all the scripts and settings - we always recommend only using it in a lower environment or for troubleshooting as it does blow the log out and can effect performance. Glad you were able to use it to figure out the issue :slight_smile:

Vanessa