We have configuration transform which supposed to replace fixed value in App.config with Octopus variable, something like this: <add key="UrlKey" value="#{UrlVariable}" xdt:Locator="Match(key)" xdt:Transform="Replace" />
It generally works as expected when UrlVariable has some meaningful value, but in some cases it is not defined or defined as empty string. In those cases instead of replacement we need to remove UrlKey from config file completely. The whole line.
Thank you, Dalmiro! It works, but unfortunately it requires UrlKey to be present (with some value) in the original config file before transform. If it is not present, then Replace would fail. Ideally I need transform which would work the same regardless of the UrlKey being present or not present in the original config.
The best I could come out with is two lines solution - first line does “InsertIfMissing” transform and second line is yours Replace or Remove. Looks ugly like hell.
Any idea how to make it in one line with less repetition of the same words again and again?