4

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.

2
  • Have you tried the advice in stackoverflow.com/questions/14962066/… ? Commented Nov 16, 2018 at 17:08
  • I did before posting, they suggest disabling warnings which is a terrible idea. Commented Nov 16, 2018 at 18:06

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

5 Comments

I selected the project dll output, that's how I'm getting the warnings.
Can happen if there are compatibility issues between projects' .NET Framework versions.
When I change the Class Libraries Target Framework, .Net 4.6.1 is not in selection. The only options are .Net Standard frameworks. How can I get it to change to .Net 4.6.1. Should I just change my Windows Application to .NET or would that just break compatibility?
The Class library is .NET Standard 2.0
What about the other one?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.