1

I am trying to change the values of some appsetting keys while running locally.

So, i have my original Web.config which has thoses keys

<appSettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="config" value="Release" />
  </appSettings>

I am trying to change the value of "config" key in the web.debug.config,

<?xml version="1.0"?>

<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings>
    <add key="config" value="Debug" xdt:Transform="Replace" xdt:Locator="Match(key)" />
  </appSettings>

  <system.web>
  </system.web>
</configuration>

When, i am running the project locally using VS:

enter image description here

I am printing the value of config and is always showing the value from web.config, however when i click preview transformation on web.debug.config, its showing this:

enter image description here

how can i make it work locally by picking information from web.debug.config?

Hussein Salman
  • 7,806
  • 15
  • 60
  • 98
  • I couldn't find an option to preview transformation.. are you using any VS plugin, [slowcheetah](https://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5) maybe? – har07 May 17 '16 at 01:20
  • 1
    Have you had a look at http://stackoverflow.com/questions/3922291/use-visual-studio-web-config-transform-for-debugging?rq=1? – Mark Larter May 17 '16 at 17:11
  • @Mark, so you are asking to modify the project file to make that works. Actually, I hope it works by avoiding such changes because I am using VSTS for release management and i need this only on my local machine. – Hussein Salman May 17 '16 at 19:24
  • Yes, but the transformed web.config is not "auto-substituted" by VS, i.e. transform output does not overwrite the web.config file when you run. – Mark Larter May 17 '16 at 19:28
  • Yes, of course this is the problem. So, if there is no other solution except modifying the project file, i will go with it. – Hussein Salman May 17 '16 at 19:47

0 Answers0