My web.config transformation aren't working. I have it appsettings set in web.debug.config and web.release.config. What do I need to put in my main web config? I tried to show response.write(System.Web.Configuration.WebConfigurationManager.AppSettings["Location"])
and on my development computer - it shows PROD. I think I am missing something from my main web.config file?
Make sure you've selected debug when your building/compiling your project. The transformation depends on that and not on the environment you're running your app on.
Make sure you've selected debug when your building/compiling your project. The transformation depends on that and not on the environment you're running your app on.
I did the debug mode and it show's it as an empty string which I placed in my main web.config file. So how do I get it to transform the debug mode compared to the release mode when it's on the hosting website. Do I need to change something in the main web.config?
I still can't get it to work. Not sure what I'm missing. Does anyone have an example of a web.config, web.debug.config and web.release.config. I see where you're saying change it to release etc. It's still not working though.
tvb2727
Participant
925 Points
1275 Posts
Web Config transformation
Feb 16, 2013 01:41 AM|LINK
My web.config transformation aren't working. I have it appsettings set in web.debug.config and web.release.config. What do I need to put in my main web config? I tried to show response.write(System.Web.Configuration.WebConfigurationManager.AppSettings["Location"]) and on my development computer - it shows PROD. I think I am missing something from my main web.config file?
webconfig.release
<appSettings>
<add key="Location" value="PROD" />
</appSettings>
webconfg.debug
<appSettings>
<add key="Location" value="DEV" />
</appSettings>
MetalAsp.Net
All-Star
112231 Points
18268 Posts
Moderator
Re: Web Config transformation
Feb 16, 2013 05:27 AM|LINK
Make sure you've selected debug when your building/compiling your project. The transformation depends on that and not on the environment you're running your app on.
tvb2727
Participant
925 Points
1275 Posts
Re: Web Config transformation
Feb 16, 2013 06:29 AM|LINK
I did the debug mode and it show's it as an empty string which I placed in my main web.config file. So how do I get it to transform the debug mode compared to the release mode when it's on the hosting website. Do I need to change something in the main web.config?
MetalAsp.Net
All-Star
112231 Points
18268 Posts
Moderator
Re: Web Config transformation
Feb 16, 2013 10:22 AM|LINK
When you select Release when building the app it should pick up the release version of the config, I believe.
Refer: http://msdn.microsoft.com/en-us/library/dd465318(v=vs.100).aspx
tvb2727
Participant
925 Points
1275 Posts
Re: Web Config transformation
Feb 16, 2013 04:14 PM|LINK
I still can't get it to work. Not sure what I'm missing. Does anyone have an example of a web.config, web.debug.config and web.release.config. I see where you're saying change it to release etc. It's still not working though.
tdykstra
Contributor
4465 Points
625 Posts
Microsoft
Moderator
Re: Web Config transformation
Feb 19, 2013 07:08 PM|LINK
There's an example in of a similar setting in this tutorial:
http://www.asp.net/web-forms/tutorials/deployment/deployment-to-a-hosting-provider/deployment-to-a-hosting-provider-web-config-file-transformations-3-of-12
See Setting an Environment Indicator