app.config transformations in Azure Devops for different environments












0















I've got a .Net Framework 4.6.1 project, which creates a Windows Service. We want to have this built and deployed by an Azure Devops pipeline. We've successfully created pipelines for all of our .Net Core web services (using the ASPNETCORE_ENVIRONMENT variable and a set of appsettings.{ENV}.json files) but the Windows Services don't seem to play as nicely in terms of providing different configuration for different environments.



I've got XDT transformations working for the App.config XML file. I can right click the files in Visual Studio and "Preview Transform" and it works fine.



What's not clear is how I translate this to the pipeline configuration. The Build task seems to be capable of running the transform but then I'm not sure how we have a different transformation for different Deploy stages. What happens instead is that all environments end up with whatever transformation was applied to the Build Configuration selected as part of the Build step.



I've followed numerous blog posts - including this one, which claims you can have multiple build configurations, but for which I don't seem to have the setting.



What am I missing?










share|improve this question





























    0















    I've got a .Net Framework 4.6.1 project, which creates a Windows Service. We want to have this built and deployed by an Azure Devops pipeline. We've successfully created pipelines for all of our .Net Core web services (using the ASPNETCORE_ENVIRONMENT variable and a set of appsettings.{ENV}.json files) but the Windows Services don't seem to play as nicely in terms of providing different configuration for different environments.



    I've got XDT transformations working for the App.config XML file. I can right click the files in Visual Studio and "Preview Transform" and it works fine.



    What's not clear is how I translate this to the pipeline configuration. The Build task seems to be capable of running the transform but then I'm not sure how we have a different transformation for different Deploy stages. What happens instead is that all environments end up with whatever transformation was applied to the Build Configuration selected as part of the Build step.



    I've followed numerous blog posts - including this one, which claims you can have multiple build configurations, but for which I don't seem to have the setting.



    What am I missing?










    share|improve this question



























      0












      0








      0








      I've got a .Net Framework 4.6.1 project, which creates a Windows Service. We want to have this built and deployed by an Azure Devops pipeline. We've successfully created pipelines for all of our .Net Core web services (using the ASPNETCORE_ENVIRONMENT variable and a set of appsettings.{ENV}.json files) but the Windows Services don't seem to play as nicely in terms of providing different configuration for different environments.



      I've got XDT transformations working for the App.config XML file. I can right click the files in Visual Studio and "Preview Transform" and it works fine.



      What's not clear is how I translate this to the pipeline configuration. The Build task seems to be capable of running the transform but then I'm not sure how we have a different transformation for different Deploy stages. What happens instead is that all environments end up with whatever transformation was applied to the Build Configuration selected as part of the Build step.



      I've followed numerous blog posts - including this one, which claims you can have multiple build configurations, but for which I don't seem to have the setting.



      What am I missing?










      share|improve this question
















      I've got a .Net Framework 4.6.1 project, which creates a Windows Service. We want to have this built and deployed by an Azure Devops pipeline. We've successfully created pipelines for all of our .Net Core web services (using the ASPNETCORE_ENVIRONMENT variable and a set of appsettings.{ENV}.json files) but the Windows Services don't seem to play as nicely in terms of providing different configuration for different environments.



      I've got XDT transformations working for the App.config XML file. I can right click the files in Visual Studio and "Preview Transform" and it works fine.



      What's not clear is how I translate this to the pipeline configuration. The Build task seems to be capable of running the transform but then I'm not sure how we have a different transformation for different Deploy stages. What happens instead is that all environments end up with whatever transformation was applied to the Build Configuration selected as part of the Build step.



      I've followed numerous blog posts - including this one, which claims you can have multiple build configurations, but for which I don't seem to have the setting.



      What am I missing?







      c# azure-devops azure-pipelines azure-pipelines-build-task






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 '18 at 15:46









      Daniel Mann

      39k66086




      39k66086










      asked Nov 20 '18 at 15:37









      Jeremy GoochJeremy Gooch

      3223819




      3223819
























          1 Answer
          1






          active

          oldest

          votes


















          1














          What we do with VSTS which I assume is similar in the newer Azure Devops. We have the transformation add tokens to the config file IE "DefaultConnection": "Server=DBServer;Database=DB;User ID=DBUser;Password=DBPassword;" Then There is a task on the release enviroment called Tokenization which pulls variables set from the release enviorment to replace the underscored tokens.



          We use this plugin to do the tokenization step. https://marketplace.visualstudio.com/items?itemName=TotalALM.totalalm-tokenization






          share|improve this answer
























          • Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

            – Jeremy Gooch
            Dec 18 '18 at 10:25











          • Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

            – Ryan Schlueter
            Dec 18 '18 at 15:52











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396466%2fapp-config-transformations-in-azure-devops-for-different-environments%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          What we do with VSTS which I assume is similar in the newer Azure Devops. We have the transformation add tokens to the config file IE "DefaultConnection": "Server=DBServer;Database=DB;User ID=DBUser;Password=DBPassword;" Then There is a task on the release enviroment called Tokenization which pulls variables set from the release enviorment to replace the underscored tokens.



          We use this plugin to do the tokenization step. https://marketplace.visualstudio.com/items?itemName=TotalALM.totalalm-tokenization






          share|improve this answer
























          • Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

            – Jeremy Gooch
            Dec 18 '18 at 10:25











          • Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

            – Ryan Schlueter
            Dec 18 '18 at 15:52
















          1














          What we do with VSTS which I assume is similar in the newer Azure Devops. We have the transformation add tokens to the config file IE "DefaultConnection": "Server=DBServer;Database=DB;User ID=DBUser;Password=DBPassword;" Then There is a task on the release enviroment called Tokenization which pulls variables set from the release enviorment to replace the underscored tokens.



          We use this plugin to do the tokenization step. https://marketplace.visualstudio.com/items?itemName=TotalALM.totalalm-tokenization






          share|improve this answer
























          • Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

            – Jeremy Gooch
            Dec 18 '18 at 10:25











          • Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

            – Ryan Schlueter
            Dec 18 '18 at 15:52














          1












          1








          1







          What we do with VSTS which I assume is similar in the newer Azure Devops. We have the transformation add tokens to the config file IE "DefaultConnection": "Server=DBServer;Database=DB;User ID=DBUser;Password=DBPassword;" Then There is a task on the release enviroment called Tokenization which pulls variables set from the release enviorment to replace the underscored tokens.



          We use this plugin to do the tokenization step. https://marketplace.visualstudio.com/items?itemName=TotalALM.totalalm-tokenization






          share|improve this answer













          What we do with VSTS which I assume is similar in the newer Azure Devops. We have the transformation add tokens to the config file IE "DefaultConnection": "Server=DBServer;Database=DB;User ID=DBUser;Password=DBPassword;" Then There is a task on the release enviroment called Tokenization which pulls variables set from the release enviorment to replace the underscored tokens.



          We use this plugin to do the tokenization step. https://marketplace.visualstudio.com/items?itemName=TotalALM.totalalm-tokenization







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 '18 at 15:51









          Ryan SchlueterRyan Schlueter

          1,9921918




          1,9921918













          • Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

            – Jeremy Gooch
            Dec 18 '18 at 10:25











          • Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

            – Ryan Schlueter
            Dec 18 '18 at 15:52



















          • Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

            – Jeremy Gooch
            Dec 18 '18 at 10:25











          • Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

            – Ryan Schlueter
            Dec 18 '18 at 15:52

















          Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

          – Jeremy Gooch
          Dec 18 '18 at 10:25





          Sorry for delay in replying - we've been trying a number of approaches. Can I ask what happens with regard to your Visual Studio instance? Do you still have XDT transforms / SlowCheetah config so that you're able to debug against different environments from Visual Studio?

          – Jeremy Gooch
          Dec 18 '18 at 10:25













          Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

          – Ryan Schlueter
          Dec 18 '18 at 15:52





          Yes we use the release transform to insert the tokens into our main config something similar to this <add key="directoryPath" value="DirectoryPath" xdt:Transform="Replace" xdt:Locator="Match(key)"/>

          – Ryan Schlueter
          Dec 18 '18 at 15:52




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396466%2fapp-config-transformations-in-azure-devops-for-different-environments%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

          How to change which sound is reproduced for terminal bell?

          Can I use Tabulator js library in my java Spring + Thymeleaf project?