We are using habitat in our project for a multisite implementation.

Can we setup the ConnectionStrings.config transformation in the Project/common layer of the habitat framework. Is this doable?

1 Answer 1


You can do this. You would just need to add the config file to the project and it will get published with the rest of the files and it will overwrite the file in the webroot.

I would question if you should do this tho. The connection strings get set when you install the Sitecore instance. So each developer should already have that set. If you put this file in the project and thus source control, you either need to make sure all devs have the exact same machine setup or they will have to make changes and not commit those.

Also you end up potentially having SQL Server logins stored in plain text. Not something I would be comfortable with. So while you can do it, I would recommend not doing it.


Environment Transforms

As an update to the previous answer, I agree totally with @jammykam. If you need to update connection strings per environment, that is where you need to tokenize your values in the source file and then use your release management tool, whether that be Octopus Deploy, TFS Release Manager etc... to substitute those tokens with the real values.

For local development, you can then use a .debug.config transform and a tool like SlowCheetah to make sure your development values are added. That is how I work with all configs not just the connection strings.

  • 1
    We have a config transform that sets Octopus Deploy variable tokens. ConnectionString details are set in Octopus and not source control... agree with not storing these in source control but it is doable (and sometimes practical for several reasons)
    – jammykam
    Commented Oct 29, 2017 at 16:33
  • thanks Richard and jammykam. We mainly need this for the setting different connection string values for the the different environment. Since we are using Octopus, hope it will be good to set the variables in script for each environment
    – PVM
    Commented Oct 29, 2017 at 23:43
  • Hi Richard,We are planning to use the Octopus that can tokenize our values in the source-file.
    – PVM
    Commented Nov 1, 2017 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.