简体   繁体   中英

Referencing a Project in the Same Solution in Visual Studio

I have a Solution with two projects. One of the projects is a library with a DLL file. I want to be able to reference this project library in the other project to use its classes. My end goal is to do this, while still having access to the libraries source code. I've tried referencing the .dll, I've also tried referencing the .csproj. Both cases work but I get 120 warnings for code CS0436:

Warning CS0436  The type 'BitField' in 'C:\FilePath' conflicts with the imported type
'Typename' in 'LibraryName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. 
Using the type defined in 'C:\FilePath'.    LibraryName C:\FilePath 38  Active

I've spent over an hour reading MSDN guides and other posts on this site. Because of this, I would greatly appreciate if no one labels this as a duplicate thread.

You only need to right click on your project and choose Add -> Reference.. In this window choose projects from the left tab and select your project with dll output.

Also be sure your projects has the same .Net framework as their targets.

Good Luck

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