如何添加对WinForm项目的引用?
我有几个不同解决方案的 winform 项目。
如果我在同一解决方案中有两个 winform 项目,当我添加引用时,我会进入“项目”选项卡,从那里我可以引用我的其他项目。但是,当 winform 项目位于不同的解决方案中时,如何引用它呢?当我浏览Windows资源管理器时,似乎没有可以使用的文件。
谢谢你!
I have a few winform projects in different solutions.
If I have two winform projects in the same solution, when I add a reference, I go on the Projects tab and from there I can reference my other projects. But how can I reference a winform project when it is in a different solution? There seems to be no file I can use when I browse the windows explorer.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
使用
添加引用
对话框中的浏览
选项卡,然后选择要从文件系统添加为引用的程序集:在第二个解决方案中有一个
lib
文件夹是个好主意,您可以在其中放置所有第三方程序集它要求它完全独立。因此,在这个 lib 文件夹中,您可以将从其他项目生成的程序集放入其他解决方案中。请注意,程序集并不一定意味着 DLL。它也可能是一个 EXE。Use the
Browse
tab in theAdd Reference
dialog and select the assembly you would like to add as reference from the file system:It would be a good idea to have a
lib
folder inside your second solution in which you would put all third party assemblies that are required by it so that it is totally independent. So inside thislib
folder you would put the generated assembly from some other project in some other solution. Note that an assembly doesn't necessarily means DLL. It could be an EXE as well.您可以将项目本身添加到解决方案中,然后添加对其的项目引用。或者您可以添加对该项目的二进制文件的引用。
You can add the project itself to your solution, then add a project reference to it. Or you can add a reference to the binary of that project.
您可以将项目添加到您的解决方案中(一个项目可以位于多个解决方案中)。
另一种选择是将已编译的程序集(.exe 或 .dll)添加为普通引用。
You can add the project to your solution (one project can be in more than one solution).
Another option would be to add the compiled assembly (.exe or .dll) as a normal reference.
您需要将项目添加到解决方案中才能添加引用。您可以通过右键单击解决方案 --> 来做到这一点添加现有项目。
您可以轻松地在不同的解决方案中拥有相同的项目,而不会出现任何问题。
您还可以添加对生成的程序集的引用,但可能会失去一些调试功能。
You need to add the project to the solution in order to add a reference. You can do that by right clicking the solution --> Add existing project.
You can easily have the same project in different solutions without problems.
You can also add a reference to the generated assembly, but you may lose some debugging capabilities.