Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ryios 122 posts 263 karma points
    Dec 15, 2014 @ 03:22
    Ryios
    0

    Move away from using separate .config files.

    I think umbraco should move away from using external .config files to support Web.Config transformations.

    The way we prefer to manage umbraco is in visual studio 2013 using the nuget package and subversion source control.

    Deployments are tedious though, requiring courier is fine, but what's really difficult is deploying packages because the config files for a package are set differently between the local environments, dev environments, and production environments.

    We use Web Deploy (via MSDeploy) to deploy our site (all the views, css, javascript etc) which works great, except we have to exclude .config files from the publish or it will overwrite the destination files and we have to manually update them.

    I think a better approach to everything would have been to have it all in the sites web.config file and not split it up. Sure it would be large, but if you created a ConfigurationSection for each part, and ConfigurationElement's for each piece in each section, it would all be separated nicely.

    We actually move a lot of umbraco's external config files into the web.config now. Then we get rid of the config source attributes. Web.Config transforms don't work on externally linked config files.

    In a perfect world, it would be awesome if all I had to do to deploy a project is

    Publish -> Dev Server or Publish -> Production Server

    That's basically what we have accomplished, except for packages and internal database stuff.

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Dec 15, 2014 @ 06:04
    Nicholas Westby
    100

    We actually move a lot of umbraco's external config files into the web.config now. Then we get rid of the config source attributes.

    Does that mean you have a working solution already? If not, here are some more ideas...

    You can actually transform those config files like you can with the web.config (well, almost like with the web.config). Check out: http://www.codeproject.com/Articles/584908/Umbrazure-Limitless-Websites-with-Umbraco-on-Azure#challenge2multipleenvironments

    Taking the UrlRewriting.config file as an example, you can have multiple config transforms: http://umbrazure.blob.core.windows.net/challenge2/daddrewrite_transforms.png

    Rewrite Transforms

    Basically, you just have to modify your project file to transform that config file (or any other file) based on the build configuration (debug, release, etc.): http://umbrazure.blob.core.windows.net/challenge2/dmsbuildtransforms.png

    Xml Transform Configuration

    Note that this will only work if you have a web application rather than a website.

    Alternatively, I suppose you could have web.config transforms change the config source for the external config files (disclaimer: I've never tried that). For example, you could have a web.config transform change this:

    <settings configSource="config\umbracoSettings.config" />
    

    To this:

    <settings configSource="config\umbracoSettings.production.config" />
    

    Though, things might break if plugins and such are expecting the original file paths.

  • Ryios 122 posts 263 karma points
    Jan 14, 2015 @ 07:17
    Ryios
    0

    Oh wow, I never even considered transforming the configSource, that's genius and solves almost all of our problems. Thanks for that.

Please Sign in or register to post replies

Write your reply to:

Draft