Web.config transformation put enter value for empty value in Octopus variable

Hi All,
I have a problem with the latest update of Octopus. In some situations, we need to use empty variable value in Octopus for our environments deploy. This is asp.net application. When Octopus perform web.config variables replacement, he put enter value in a place where should be an empty string. Before the update to version 2018.7.8 problem never occurred.
web.config view
image
octopus variables view

Regards
Adrian

Hi Adrian,

Thanks for getting in touch.
If I understand correctly when you do variable replacement on your Web.config file a variable that should be empty ends up with “Enter value”?
I’ve tried to reproduce but I get an empty value. The screenshot of your Web.config file looks correct to me, the variables substituted are False and empty.

I feel like I’m not understanding the issue, can you explain more about what is happening?

Thanks
Shane

Ok, step by step.
-In Octopus we have variable with empty value like on picture below

-Our transformation Octopus.config looks like


-Octopus update variables in Octopus.confing in correct way like:

But at last, Octopus perform the transformation from Octopus.config to Web.config and result is:
image

That new line symbol between <value> </value> tags is readed by .net like new line, not empty value and it is a problem for us.
Maybe problem only occurred in Transform=“Replace” and it is the transformation engine problem?

Hi Adrian,

Thank you for the explanation.

Yes, the extra newlines are added by the transformation library we are using: Microsoft.XDT. It looks like a lot of people have run into the same issue.

I noticed that SetAttributes transformation doesn’t suffer from the same problem, would it be possible to use that instead? For example:

        <mySettings>
            <setting name="InstrumentationKey" serializeAs="string" xdt:Transform="SetAttributes(value)" xdt:Locator="Match(name)" value="#{Empty}" />
            </setting>
        </mySettings>
            <setting name="InstrumentationKey" serializeAs="string" value="A value" />
            </setting>

Cheers,
Shane

Hi Shane,
I hoped it will be worked. Unfortunately not. .Net can’t read that kind of setting with a result:

Regards
Adrian

Maybe Octopus Team should update that Microsoft library?

Defect was fixed by Microsoft.

Hi Adrian,

Unfortunately the defect has not been fixed. I have tried with the latest version (2.1.2) from NuGet and it still applies the special formatting: https://www.nuget.org/packages/Microsoft.Web.Xdt/.

I can’t think of a decent workaround other than to handle the extra newline in your application. :frowning:

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