Copied to clipboard

Flag this post as spam?

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


  • iqb-dawn 21 posts 101 karma points
    Mar 17, 2022 @ 17:52
    iqb-dawn
    0

    Azure Dev Ops Deployment, Azure App Service and Web.Config

    We have a GitHub repo where we don't have web.config, means we have this in .gitignore file,

    **/Web.config
    **/Web.Debug.config
    **/Web.Release.config 
    

    We have Web.config.template which will generate web.config, whenever we build the project (I assume that imported Umbraco targets in csproj is doing this action).

    Now I need to update the web.config to add some http handlers and modules. I will do it in web.config and Web.config.template files. Then we push the change (only Web.config.template get push without web.config) to Github and Azure DevOps will trigger CI and CD pipeline.

    When CD pipeline deploy changes to Azure App Service, I don't see my changes (done in Web.config.template file). I need to manually update the web.config in Azure App Service.

    The problem is that every time there is new change (even without config file involved) I need to redo the config changes manually. So, If I change a single cs file and deploy using CI/CD pipeline then my changes in Azure App Service web.config get overwritten and I need to manually do the update again.

    How the deployment you guys doing for this scenario?

  • Ambert van Unen 175 posts 819 karma points c-trib
    Mar 17, 2022 @ 19:22
    Ambert van Unen
    0

    Why not just add the web.config/debug/release and use Azure KeyVault for secure information (like the connectionstring etc?)

    Makes it much easier!

  • iqb-dawn 21 posts 101 karma points
    Mar 18, 2022 @ 06:38
    iqb-dawn
    0

    Hi @Ambert, the problem is that the repo is already configured like this so I thought it may be Umbraco recommendation as in the top of the file I see,

    Define the Web.config template, which is used when creating the initial Web.config, and then transforms from web.Template.[Debug|Release].config are applied. Documentation for Web.config at: https://our.umbraco.com/documentation/Reference/Config/webconfig/

  • iqb-dawn 21 posts 101 karma points
    Mar 18, 2022 @ 07:44
    iqb-dawn
    0

    After testing I found that Web.config.template is not used at all. If no web.config the new web.config is generated (from where I dunno).

    The problem is that Azure DevOps is generating always a new web.config and deploy the new one. How can I tell to not generate the one and use mine?

  • iqb-dawn 21 posts 101 karma points
    Mar 18, 2022 @ 14:28
    iqb-dawn
    100

    I have added these lines to in csproj to copy my file at build time if web.config is missing and deploy Web.config.template with Web.config,

      <Target Name="MyCmsCopyConfigIfNotExist" BeforeTargets="CopyUmbracoFilesToWebRoot">
        <Copy SourceFiles="Web.config.template" DestinationFiles="Web.config" OverwriteReadOnlyFiles="True" Condition="!Exists('Web.config')" />
      </Target>
      <Target Name="MyCmsCopyConfigIfNotExistForDeploy" AfterTargets="CopyUmbracoFilesToWebRootForDeploy">
        <Copy SourceFiles="Web.config.template" DestinationFiles="$(_PackageTempDir)\Web.config" OverwriteReadOnlyFiles="True" />
      </Target>
    
Please Sign in or register to post replies

Write your reply to:

Draft