I have a ASP.NET MVC 4 web project
WebUI
that references a ASP.NET 4 Code Library
DAL
The Code Library has a reference to the SlowCheetah
2.5.5 NuGet package and is setup with several transformations for it's App.Config
.
The WebUI
is using the normal Web.Config
transformations but I have also added a reference to SlowCheetah
as a test for my problem but it didn't change my issue.
When I publish using
MS Web Deploy
in Visual Studio 2012 or when I publish straight to
File System
using a QA
configuration the correct Web.QA.config
is put in the root of my website, however the referenced class library configuration is not working, I get a sql connection error on the home page which alerts me that the correct App.Config
transformation is most likely not being used for the referenced DAL
project.
I thought this would be a .dll.config
file in the bin
folder for the WebUI
, but I am not too sure as I have this working on another web server where I manually changed the default App.Config
and Web.Config
files and there is no .dll.config
file present in the root bin
directory of the website.
Anyone know how to get this working?
UPDATE:
Examples below:
DAL
Code Library project App.Config
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="DAL.Properties.Settings.DefaultConnection" connectionString="Data Source=(local);Initial Catalog=MyDB;Integrated Security=True;" />
</connectionStrings>
</configuration>
Part of Web.Config
from my WebUI
project
<connectionStrings>
<add name="WebUI.Properties.Settings.DefaultConnection" connectionString="Data Source=(local);Initial Catalog=MyDB;Integrated Security=True;" />
</connectionStrings>
I use a Settings.settings file for each project.
How can I merge the App.Config connection into my Web.Config so that it is transformed during publishing? preferably I would want it to just use the one connection when publishing to the web.
At the moment the DAL
referenced project works on the web application if I set the app.config
correctly (which only makes some sense to me since its a referenced .dll).
Does adding this DAL.Properties.Settings.DefaultConnection
connection to my web.config
replace the one the DAL
is using?