简体   繁体   中英

How to add a reference to a WinForm project?

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!

Use the Browse tab in the Add 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 this lib 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.

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.

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