Change connection string for all of projects in a solution
I hav开发者_Go百科e 2 projects in one solution. How can I change both connection string in one of them?
Have the connectionstring in one project and expose it by a method that returns the connectionstring. The other project references the first and uses that method at all places that require a connectionstring.
Be aware, that this only makes sence if both projects can be referenced logically. If not use a third project, that only contains the connectionstring and exposes it by such method.
What you probably need is a shared app.config and this can be done very easily with linked files within Visual Studio.
In the screenshot below you can see how it's done:
精彩评论