share connectionstrings with multiple projects in same solution

1.9k Views Asked by At

I have multiple projects in the same solution. I would like them to share the same connectionStrings so that I don't have to change the this in multiple places.

In my web configs I have

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

and then I have added a file as a link to my "connectionsStrings.config" which sits at the solution level.

I have changed the properties so that the "Copy to Output Directory" is "Copy always" and the "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 issue, any help would be great.

Cheers

1

There are 1 best solutions below

1
On

I fixed this by changing

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

to

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

:/