Reputation: 135
Inside my Bin folder I created another folder called "Template" (Bin > Template). Inside the Template folder I have a set of dll's, of which I would like to call from a class; like... using Bin.Template.Example.ClassName;
Is it possible to accomplish this?
Upvotes: 0
Views: 4320
Reputation: 8991
To use an external DLL from the filesystem, you need to add a reference at the project level. Right click References
under your project, and choose Add Reference...
:
Then click Browse
button, locate the DLL, press Ok
.
Inside your class file, add using <dll.name.space>;
to the top.
Upvotes: 0
Reputation: 646
Yes you can use Assembly.LoadFile
to load external assemblies.
var x = Assembly.LoadFile("myFile.dll");
var myObject = x.CreateInstance("MyClass");
However you will not have strongly typed access to the resulting object.
Consider using dependency injection instead, where you will be able to load assemblies and know the types.
Upvotes: 1