Multiple config files on different projects ASPNET MVC

2

I have a problem and maybe someone can help me.

I'm working on a ASPNET MVC project so I've structured the solution into multiple projects to break down the different components.

In my main project web.config file (for example PROJETO1.Principal ) I'm trying to set up to fetch references from the connection strings of the general project (for example PROJETO.Geral ), in this general project I have the files app.config that contains my connections strings.

The general.config code looks something like this:

<connectionStrings configSource="app.config"></connectionStrings>

In my code app.config looks like this:

<?xml version='1.0' encoding='utf-8'?>
<connectionStrings>'
(lista minhas connections strings)'  
</connectionStrings>

But it does not work, the error below occurs:

  

The configSource file 'app.config' could not be opened.

I tried to specify the path of the file, the following error occurs: The configSource attribute must be a relative physical path.

It's worth mentioning that the error occurs at the point that I try to open the list of connections using ConfigurationManager (I also tried with WebConfigurationManager but without success).

Another thing, if the file app.config was within the same project it would work without problem.

    
asked by anonymous 23.01.2015 / 14:51

1 answer

1

I found the answer (I'll post it here if anyone else has this problem).

I re-created the file in the main project using "add existing item" and created it as a link.

I used this reference: link

Thank you

    
23.01.2015 / 19:07