Pergunta

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

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top