views:

1992

answers:

2

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

A: 

Can you check to make sure the package is being built in the correct configuration (Production)? Can you check to see which web.config gets into the package?

I haven't actually tried this yet.

John Saunders
Package is being created in the Production config file setting only.
BALAMURUGAN
+8  A: 

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... -Vishal

Vishal R. Joshi