Web.config transformation for different websites

46 views Asked by At

I have one project for publishing two separate websites on different servers. Both websites is in different languages (En and tr).
For web-deploy I want to change appsettings for different environments for Debug and Release (For both websites). I added config files for transformations like this: enter image description here

Appsetting in main Web.config:

<add key="WebsiteMainCulture" value="en-US"/>

The code in transformation files are accordingly like this:

<appSettings>
    <add key="WebsiteMainCulture" value="TR"
         xdt:Locator="Match(key)" xdt:Transform="Replace"/>
  </appSettings>

I selected Web.TR.Debug.config and ran project, But I always get 'en-US' as WebsiteMainCulture.

string website_main_culture = ConfigurationManager.AppSettings["WebsiteMainCulture"].ToString(); // always en-US

Please help. Is there any better approach suggested for same environment?

Thanks!

1

There are 1 answers

0
kpr On

I got the solution for the problems I asked, also related to my previous question here: https://stackoverflow.com/questions/30612865/selecting-correct-seed-method-for-particular-language I just added config transformation files by right clicking, to relevant publish(web deploy) files.Then added desired values to keys. And it worked.

enter image description here

Here are config transformation file auto generated.

enter image description here