I'm trying to move all of our connection strings to external files but I can't get our production app to run - when publishing we receive an Error that says:
**
Web.config Connection String argument cannot be null or empty.
**
I wonder if the Release transform is not working.
FYI - we have all file properties set Copy To Output Directory
to Copy Always
We have 5 files -
1) Web.config
2) Web.Release.config
3) Web.Debug.config
4) Configurations\Debug.Conn.config
5) Configurations\Release.Conn.config
For Development: (this is working)
Web.config
& Web.Debug.config
contains:
<connectionStrings configSource="Configurations\Debug.Conn.config" />
The config source is pointed to our local dev database and is working:
Configurations\Debug.Conn.config:
<connectionStrings>
<add name="AppDB"
connectionString="Data Source=DESKTOP-ABCDEF;Initial Catalog=MyApp;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
For Production: (This is not working)
Web.Release.config
contains:
<connectionStrings xdt:Transform="Replace" configSource="Configurations\Release.Conn.config" />
The configSource is pointed to our Production Database.
Configurations\Release.Conn.config:
<connectionStrings>
<add name="AppDB" connectionString="Data Source= ... Production Database ... '" />
</connectionStrings>
--
Firstly: In all my searching for an answer I was only able to find posts regarding transformations using the Web.config main files - barely any mentioned using external files using configSource
Secondly: The transformations work when I remove the external files and put the data directly into the Web.config files - but that defeats the purpose of what we're trying to do.
So - I can't tell what is missing to get the Production DB from replacing the connectionStrings when publishing.