AppSettings.json file being updated before the deployment happens

I have an issue where I’m trying to update appsetting.json with my project variables but looking at the output from the task log it seems like the appsettings.json is being updated before the actual deployment package is copied into that folder.

Hi Mark,

Thanks for reaching out!

What appears to be happening here is that the variable substitution has been explicitly set to target the Custom Install Directory files, instead of the temporary working directory. Due to our Package Deployment Feature Ordering (Specifically steps 8 & 9), this means that the substitution is occurring on the old files instead of the new ones, and those old files are being purged and replaced with the new un-substituted files.

I’d be happy to check over your configuration, however this should be resolved by modifying the Structured Configuration Variables target files to not specify the custom install directory but to search for the files based from the root of the package.

e.g. Try \appsettings.json instead of #{Octopus.Action.Package.CustomInstallationDirectory}\appsettings.json

Let me know how you get on or if missed the mark completely and doesn’t help resolve the issue. I’d be happy to take a further look into it if you send through your Structured Configuration Variables setup.

Best Regards,

Thanks for getting back so quickly, however on doing that I now get the message that the appsettings.json file cannot be found.

Just before I sent this off I tried that without the preceding \ and it worked. Thanks for the help.

End Result

Hi Mark,

Awesome, glad to hear it’s working!

Apologies I should have left off the preceding slash, I’ll definitely make a note for next time :slight_smile:

Feel free to reach out anytime if you have any further issues or questions!

Best Regards and Happy Deployments!

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