+ 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.
6 odpowiedzi
+ 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
+ 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
+ 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?
+ 2
Can you post the code in text ? Did you created it as a class library ?
+ 1
@sneeze there were no flaws in the codes, it was only the building method and .DLL type that needed attention
+ 1
Well done !!