문제

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