Substitute variables in files feature producing error when targeted file are not found in nuget package

Hi all, For one of my project I have enabled a feature called Substitute variables in files which will Substitute variables in target files based on the variable set that I have created in the project. However when a package is not containing the files that need to replace EX: Substitute variables in files feature have file path set to WebUI*.config but nuget package does not contain any config files, it will generate error and prevent other steps to be proceed. The picture below shows the error I get.

After i disabled the Substitute variables in files feature, the release is successful.

Is there any solution to solve this problem such as maintain Substitute variables in files feature on while not generate any error if the target file path is not found inside the nuget package?

Thanks in advance :slight_smile:

This is the error screen shot that i get when no targeted file path is found in a packge

Hi Isaac,

Thanks for reaching out! This is actually by design. Octopus uses Continuous Delivery best practices and one of those is having an artifact that at any version can be deployed to a new machine. This means that we will expect that if you have a file you want to substitute that it will be in any version, and if it was missing you would want to know about that! While we can support partial deployments and not complete artifacts, you would not be able to define files in this feature that will not be part of the package each time.

A workaround for your situation would be to keep the file in the package, even if it’s empty. That way it’ll read the file as existing still and not give you the error.

I hope that helps!



This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.