在同一解决方案中与多个项目共享连接字符串 [英] share connectionstrings with multiple projects in same solution

查看:71
本文介绍了在同一解决方案中与多个项目共享连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同一解决方案中有多个项目。我希望他们共享相同的connectionStrings,这样我就不必在多个地方更改它。

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.

在我的Web配置中,我有

In my web configs I have

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

然后我添加了一个文件作为指向 connectionsStrings.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"

但是出现以下错误:

 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.

欢呼

推荐答案

我通过更改

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

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

:/

这篇关于在同一解决方案中与多个项目共享连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆