Share connections with multiple projects in one solution

I have several projects in one solution. I would like them to use the same connectionStrings, so I don't need to change this in several places.

In my web configurations I have

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

and then I added the file as a reference to my "connectionsStrings.config", which is at the solution level.

I changed the properties so that "Copy to Output Directory" was "Always Copy" and "Build Action" is "Content"

But I get the following error:

  The configSource attribute must be a relative physical path, so the '/' character is not allowed. 

I am not sure how to get around this problem, any help would be great.

Greetings

+6
source share
1 answer

I fixed it by changing

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

to

 <connectionStrings configSource="bin\connectionStrings.config" /> 

: /

+13
source

Source: https://habr.com/ru/post/949765/


All Articles