projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.
Apache License 2.0
3.12k stars 652 forks source link

XDT transform problems #2941

Closed ThomasArdal closed 5 years ago

ThomasArdal commented 5 years ago

I'm trying to learn how to utilize applicationHost.xdt and XDT transformations to add features to my website. The simplest possible example I can think of is to add a new app setting through an applicationHost.xdt file.

I create a new file named applicationHost.xdt in the D:\home\site folder. The file has the following content:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings xdt:Transform="InsertIfMissing">
    <add key="Hello" value="World" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
  </appSettings>
</configuration>

I've created a small test website, that does nothing more than get the value of Hello and display it on the screen. No value is shown on screen.

I've remembered to restart the site after saving the applicationHost.xdt file. I've also checked D:\home\LogFiles\Transform for errors. No errors are shown in the log file for neither scm nor main.

Any ideas to help me move forward?

ThomasArdal commented 5 years ago

Closing this since I found out why this isn't working as I expected. When adding appSettings like this, app settings are added to the applicationHost.config file, which isn't supported or what I really want.