C#项目引用的问题 [英] C# project reference's question

查看:133
本文介绍了C#项目引用的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个C#解决方案及其由无数个项目。

I have a c# solution and its composed of numerous projects.

我有一个项目,是我的baseassemblies持有的其他项目中使用的所有公共信息。然而,所有其他项目都baseassemblies引用。

I have a project that is my baseassemblies that holds all common information that other projects use. All of the other projects have references to baseassemblies.

我说在我的baseassemblies一个dll引用的所有其他项目无法看到它。

I added a dll reference in my baseassemblies however all of the other projects cant see it.

我怎样才能让这个其他的项目可以看到,baseassemblies所引用的DLL?我不希望有该DLL添加到所有的项目,因为这违背了我的baseassemblies项目的目的。

How can I make it so that the other projects can see the DLL that baseassemblies is referencing? I dont want to have to add the DLL to all of the projects since that defeats the purpose of my baseassemblies project.

推荐答案

的正确的做法是您的其他组件就是不用其他DLL的引用。正确地做到这一点的方式,是不是有你的基本组件暴露任何是DLL内的类型。总结你在底座组件所需的所有功能,并确保无论谁消耗你的基础组件,需要底层DLL的基本组件没有知识使用。否则,每个将引用您的基本组件,如果他们需要使用的包含在该DLL项目的东西,他们就必须引用它。

The correct approach is for your other assemblies NOT to need a reference to that other DLL. The way to correctly do that, is to not have your base assemblies expose any of the types that are within that DLL. Wrap all the functionality that you need in the base assemblies, and make sure that whoever consumes your base assemblies, needs NO knowledge of the underlying dll's base assemblies is using. Otherwise, each project that will reference your base assemblies, if they need to use something that's contained in that dll, they'll have to reference it.

这篇关于C#项目引用的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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