无法在 vb 6 项目中添加由 vb.net 创建的 dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18307239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 14:42:54  来源:igfitidea点击:

Can't add dll created by vb.net in vb 6 project

vb.netdllvb6

提问by SHINHAN

I'm trying to add a dll created from vb.net and i want to import it in existing vb 6 project but it gives me error "can't add reference to the specified file." . Anyone knows how can i fix this issue?

我正在尝试添加一个从 vb.net 创建的 dll,我想将它导入到现有的 vb 6 项目中,但它给了我错误“无法添加对指定文件的引用”。. 任何人都知道我该如何解决这个问题?

回答by Nadeem_MK

There are the steps to follow:

有以下步骤:

1) Create a class library in VS choose whatever language you want either Vb.NET or C#

1)在VS中创建一个类库选择你想要的任何语言Vb.NET或C#

2) Goto to Project Properties->ConfigurationProperties->build, check the Register for COM Interop checkbox. This creates the COM wrapper for your .NET assembly and hence need not use regasm.

2) 转到 Project Properties->ConfigurationProperties->build,选中 Register for COM Interop 复选框。这会为您的 .NET 程序集创建 COM 包装器,因此不需要使用 regasm。

3) Write whatever code you want, expose the classes publicly, expose the properties, functions you want publicly.

3) 编写你想要的任何代码,公开类,公开你想要的属性和函数。

Now in your VB6 project, add the claslibrary.tlb created by the above program. Now use the classes and functions as you want.

现在在您的 VB6 项目中,添加由上述程序创建的 claslibrary.tlb。现在根据需要使用类和函数。