[英]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: 我正在尝试使用以下内容访问项目的bin文件夹中的DLL:
[HttpPost]
public ActionResult EncryptFile()
{
Assembly SampleAssembly;
var dllFile = new FileInfo(@".\\bin\\encrypt.dll");
SampleAssembly = Assembly.LoadFile(dllFile.FullName);
//...trimmed...
}
I also attempted var dllFile = new FileInfo(@"\\\\bin\\\\encrypt.dll");
我还尝试了
var dllFile = new FileInfo(@"\\\\bin\\\\encrypt.dll");
(note lack of .
before the filepath), but it did not work either. (请注意,在文件路径前缺少
.
),但是它也不起作用。 In the debugger, the FullName
returns \\\\\\\\bin\\\\encrypt.dll
in this second case. 在第二种情况下,在调试器中,
FullName
返回\\\\\\\\bin\\\\encrypt.dll
。
What can I do to make it locate the file? 我该怎么做才能找到文件?
Thank you. 谢谢。
做
Assembly SampleAssembly = Assembly.LoadFile(Server.MapPath(@"~/bin/encrypt.dll"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.