C# DLL import fail [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

C# DLL import fail [Solved]

I create a DLL file on Visual Studios 2017. It compiled successfully with no errors. The problem is that when I refer to it in other C# programs I can not import it into my program. (I can refer to it, and it's under references, but I can't type "using MyDLL;") I've tried changing the Namespace-, Class-, and File-Name multiple times. The tutorials online doesn't talk about this problem.

2nd Feb 2018, 8:43 AM
Limitless
Limitless - avatar
6 Answers
+ 1
I solved it... it was complicated to me but I learned something. The first step is to use the Standard .DLL Project and not the Framework Project. The second step is to make sure your VS is updated because that was one of the bugs in early VS Versions 4.7.02### The third step is to be sure that it's building for .NET Standard 2.0 and I also added an XML file to go with the library. These steps solved my problems
8th Feb 2018, 6:22 PM
Limitless
Limitless - avatar
+ 2
Do you really need to import ? In my opnion the only thing you need to do is. add reference add using statement use the objects
2nd Feb 2018, 4:37 PM
sneeze
sneeze - avatar
+ 2
yeah, import = using (I think) It's supposed to be that simple, but I've tried it over and over. Could it be that I have faulty configuration?
2nd Feb 2018, 4:39 PM
Limitless
Limitless - avatar
+ 2
Can you post the code in text ? Did you created it as a class library ?
2nd Feb 2018, 4:41 PM
sneeze
sneeze - avatar
+ 1
@sneeze there were no flaws in the codes, it was only the building method and .DLL type that needed attention
8th Feb 2018, 6:23 PM
Limitless
Limitless - avatar
+ 1
Well done !!
8th Feb 2018, 7:06 PM
sneeze
sneeze - avatar