Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web.Config Transformation in VS2010

I am working in the web.config transformation file concept. I have three web config. One is Staging, Production, Deployment. I have different connection information for these three.

Web.Config:

  <connectionStrings>
    <add name="MyGallery"
   connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DevelopmentStorageDb;Data Source=BALA\SQLEXPRESS" />
  </connectionStrings>

Web.Config.Production:

<add
    name="MyGallery"
    connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SharePoint_Config;Data Source=BALA\SQLEXPRESS"
    xdt:Transform="Replace" xdt:Locator="Match(name)"
    />

Now I build the code it is working fine. I have created the package. When I run the code in Production mode the new connections string is not taking up.

How can I solve this. Do I need extra effort to move this to somewhere

like image 955
web dunia Avatar asked Dec 08 '22 06:12

web dunia


1 Answers

The naming to be used is Web.Production.Config instead of Web.Config.Production...

Also the more optimal transform to use here is xdt:Transform="SetAttributes(connectionString)" that way the XDT engine will only modify the connectionString attribute and keep the add node as is...

like image 75
Vishal R Joshi Avatar answered Jan 03 '23 14:01

Vishal R Joshi