首页 > 解决方案 > How do I set common values (abstract) for a C# solution in Visual Studio with multiple sub projects?

问题描述

I have a solution with multiple projects each of which connects to the same DB and uses overlapping constant values that I would like to set somewhere instead of replicating manually. I have tried a variety of things online like making a custom class and linking projects to it, setting constants in a project config file (which doesn't exist like the guides claim), and so on. I've been unable to figure this out after more than an hour of searching and experimenting so if you have any ideas, let me know. The structure looks like this (the blue-underlined stuff are some of the projects in the list):

project listing in solution

标签: c#.netvisual-studiosolution

解决方案


您可以在解决方案下创建另一个项目来包含您的课程。

然后所有其他项目都可以引用该项目,这意味着所有其他项目都可以使用相同的功能,而无需复制任何内容。


推荐阅读