Hey I would love to know what you think while reading my posts. Please comment!.

Octopus Deploy

Entity Connection String within Octopus Deploy

I have been using Octopus Deploy more and more recently and it is quickly becoming my deployment tool of choice. If you haven’t heard about it, then I would highly recommend that you go and check it out now! Octopus Deply

One of the projects I have been working on uses the EntityFramework for data access, so there is a System.Data.EntityClient connection string within the web.config. The EntityClient connection string differs from the standard SqlClient string in that it contains metadata along with the connection string. It also contains " within this string.

##Problem

Here lies the problem. If you want to replace the connection string using variables within Octopus deploy, then the connection string (by default) will not be replaced correctly. What ends up happening is that " is replaced with " which results in a broken EntityClient!

Now this is by design within Octopus deploy and there is an argument whether this is actually a bug or a feature.

##Solution

The solution to this is pretty simple actually. If you copy your EntityClient connection string, then paste into an Octopus deploy varaible, replace " with ". When Octopus replaces the connection string in the web.config it automatically translates " back into "!

Job done!


About Me

Tim James I'm Tim, a web applications developer from Glasgow, Scotland. Currently working for Kingfisher Systems Ltd, building bespoke systems within the Car Auction industry.

  • C#
  • VB.NET
  • ASP.NET
  • .NET MVC
  • Web API
  • Razor
  • HTML5
  • CSS3
  • jQuery
  • WCF
  • SQL
  • knockout.js
  • Angularjs
  • AJAX
  • APIs
  • SignalR
Why not follow me on twitter? Follow me on Twitter