Sperick
Sperick

Reputation: 2761

Web.Config not transforming as expected

When I build my application using Visual Studio in either debug or release mode the connection string that I'm trying to transform doesn't get inserted into the finalised web.config file

Relevant section of web.config:

<?xml version="1.0" encoding="utf-8"?>

<configuration>
 <connectionStrings>

 </connectionStrings>
</configuration>

web.debug.config file:

<?xml version="1.0"?>

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">

  <connectionStrings xdt:Transform="Replace" />


  <connectionStrings>
    <add name="DefaultConnection" xdt:Transform="Insert" providerName="System.Data.SqlClient"
connectionString="string value" />
  </connectionStrings>

</configuration>

I've tried the files with this site and it seems to work ok

Upvotes: 0

Views: 110

Answers (1)

Sperick
Sperick

Reputation: 2761

It turns out that what I had was fine but that the modified web.config file only gets generated when you publish the website.

Upvotes: 1

Related Questions