Pricey
Pricey

Reputation: 5939

How to deploy multiple projects for an MVC website with different property settings files

I have an MVC website that also references another Class project in my solution called DAL

The MVC website has a settings.settings file that I am using for my Default database connection string, and this automatically gets updated in my Web.Config file.

However my Class project also uses a settings.settings file for a database connection (to create a connection if one is not already supplied to it by the MVC project) and I believe this is put into the App.Config file, but when it comes to deploying and running this MVC website?

What do I do for the DAL project?

I can see it has a DAL\bin\release\DAL.dll.config file in that location, does this need to go into the root of the website directory, using the same file path? or should I be doing something else?

Thanks

Upvotes: 0

Views: 256

Answers (1)

SynXsiS
SynXsiS

Reputation: 1898

You should be able to override this setting in your web.config by using the full name. If your project is called DAL you should create a connection string in your web.config which looks something like.

<add name="DAL.Properties.Settings.MyDatabaseConnectionString" 
    connectionString="Data Source=(local);Initial Catalog=myDatabase;Integrated Security=true"
    providerName="System.Data.SqlClient" />

Upvotes: 1

Related Questions