简体   繁体   中英

share connectionstrings with multiple projects in same solution

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

I fixed this by changing

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

to

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

:/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM