简体   繁体   中英

Sharing information between multiple C# projects in VS2010

I have a collection of VS2010 projects which are used in various solutions, but typically only a subset of these projects are used in any one solution. One of those projects (which I will refer to as the "base" project) exists in every solution and contains base implementations for the subclasses defined in the other projects. In other words, the base project is included in every solution because the other projects depend on it, but any of the dependent projects may or may not be included in any particular solution.

I want to know if there is a way for the base project to know which of the dependent projects exists in any one solution so that it can act accordingly. I thought that #defines would easily solve this problem (by #defining a unique symbol for each dependent project and including code into the base project accordingly), but #defined symbols can't be seen across projects. Is there an easy way to include different code in the base project depending on which dependent projects are in the solution?

EDIT: The language used in all of these projects is C#, if that makes a difference.

我认为您需要执行的操作将单独的解决方案中的常见项目提取出来,并在其他解决方案中用作参考。

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