Release Variable ConnectionString, value Attribute Not Allowed In web.config

Hello,

I’m looking to use Octopus to transform my connection strings during deployment.

However, my web.config connection strings look like this:

I have tried to set them to use name and value as suggested in the Octopus documentation, but this causes an error at runtime with my code.

How do I get around this?

Thanks very much,

Martyn.

Hi,

Can you send me a screenshot of what the variables look like in the Octopus UI?

Keep in mind that the values in the UI shouldn’t be escaped (for example, use a single \ when specifying a SQL Server instance name, not a double \), and don’t escape/encode quotes or brackets.

Regards,
Paul Stovell
Octopus Deploy
W: octopusdeploy.com | T: @octopusdeploy

Hi Paul,

Sorry, the example connection string that I tried to put in my post doesn’t show up for some reason. The problem was how the connection had to be declared within web.config:

I tried to use a value attribute instead of connectionString but this wouldn’t work when running the application.

I have now solved this issue by using a PostDeploy.ps1 script which amends the connectionString attributes using the $OctopusDeploy variable.

I’m going to write a blog post about how I’ve solved the problem, but I’m happy to send you the script if you’d like to see it for adding it to the documentation or something else?

Thanks very much,

Martyn.