view raw
ITWorker ITWorker - 8 months ago 49
ASP.NET (C#) Question

How to access DLL in bin folder of ASP.NET MVC project?

I am trying to use the following to access a DLL in the project's bin folder:

public ActionResult EncryptFile()
Assembly SampleAssembly;

var dllFile = new FileInfo(@".\\bin\\encrypt.dll");
SampleAssembly = Assembly.LoadFile(dllFile.FullName);

I also attempted
var dllFile = new FileInfo(@"\\bin\\encrypt.dll");
(note lack of
before the filepath), but it did not work either. In the debugger, the
in this second case.

What can I do to make it locate the file?

Thank you.



Assembly SampleAssembly = Assembly.LoadFile(Server.MapPath(@"~/bin/encrypt.dll"));