一个项目的Dll引用到另一个项目 [英] Dll reference of one project into another project

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

问题描述

我有2个项目,建成之一,VB.NET,另一个在C#.NET。我想用VB.NET的某些功能集成到C#.NET,所以我加入的VB.NET解决方案的DLL文件到C#.NET通过从我的系统浏览DLL的引用。

I have 2 projects, one built in VB.NET and another in C#.NET. I want to use certain functionality of VB.NET into C#.NET and hence I have added the dll file of VB.NET solution into C#.NET as a reference by browsing the dll from my system.

说DLL名称是myData.dll

Say dll name for VB.NET is myData.dll

在我的C#.NET项目,我试图把它声明为一个命名空间,即使用MYDATA的;和它给我的错误类型或命名空间名称找不到

In my C#.NET project I am trying to declare it as a namespace i.e. "using myData;" and its giving me an error of "Type or namespace name could not be found"

我缺少的东西??

推荐答案

你的VB.NET项目是如何组织的一个线索。有SOEM事情可以去错了,你obviouisly不知道他们的,所以让我们一探究竟。

A clue about how your VB.NET project is organized. There are soem things that can go wrong and you obviouisly are not aware of them, so lets find out.

根据我们的情报该dll被添加作为参考。

According to our information the dll is added as reference.

为说VB.NET DLL名称是myData.dll

Say dll name for VB.NET is myData.dll

好了,那就是DLL和你引用它

Ok, so that is the DLL and you reference it.

宣布它作为一个命名空间,即使用MYDATA的;

declare it as a namespace i.e. "using myData;"

没有,你就不会宣布它作为一个命名空间。你告诉编译器也期待在这个命名空间中的类。现在,你不告诉我们myData.dll实际上是否包含namespceMYDATA。这是一个完全不同的事情。你能做到不使用 - 如果你每一个前缀类。在using语句引用任何一个dll。

No, you do NOT declare "it as a namespace". You tell the compiler to also look in this namespace for classes. Now, you do NOT tell us whether "myData.dll" actually contains the namespce "myDAta". THis is a totally different thing. YOu can do without using - if you prefix every class. Nothing in the using statement references a dll.

这是cuold VB.NET已经缠另一namesapce,这是myData.myData。不是开玩笑。它也可能是你忘记为类公共

It cuold be VB.NET has wrapped another namesapce around and it is "myData.myData". No joke. It could also be you forgot to make the classes public.

要找出:


  • 使用对象Btrowser打开DLL(Visual Studio的菜单查看,ObjectBrowser),并期待啥子命名空间和类在DLL中。

  • 去寻找类要使用,看看它说。你可能会惊讶的说不上类和/或命名空间。

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

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