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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top