Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 439
Tim Avatar asked Oct 25 '25 19:10

Tim


1 Answers

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

like image 54
Sasan Avatar answered Oct 28 '25 10:10

Sasan