Portekoi
Portekoi

Reputation: 1157

Web.Config Debug/Release : Doesn't work

I have this in my web.config

<add name="AS400" connectionString="Provider=IBMDA400;Data Source=AAAAA;User Id=aaaaaa;Password=aaaaaa;Default Collection=*SYS;" providerName="System.Data.OleDb" lockItem="true"/>

In my Web.Debug.config (The same of Webconfig)

 <add name="AS400" connectionString="Provider=IBMDA400;Data Source=AAAAA;User Id=aaaaaa;Password=aaaaaa;Default Collection=*SYS;" providerName="System.Data.OleDb" lockItem="true" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

In my Web.Release.config

 <add name="AS400" connectionString="Provider=IBMDA400;Data Source=ZZZZZ;User Id=aaaaaa;Password=aaaaaa;Default Collection=*SYS;" providerName="System.Data.OleDb" lockItem="true"  xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

But nothing working. If i make F5, in Release mode, i have always the connection string in web.config.

An idea?

Upvotes: 4

Views: 5409

Answers (1)

Tim B
Tim B

Reputation: 2368

Configuration transformation is only done when publishing. Your base configuration file should have your development settings. If you choose to use the default build configurations, normally the release transform file should contain your production environment settings and the debug transform file will contain your test environment settings.

Personally, I usually create a new build configuration for testing and for production and leave the debug and release transforms empty.

Edit: If you use the latest version of the SlowCheetah extension for Visual Studio, it will transform your configuration files during the build.

Upvotes: 12

Related Questions