[英]Could not load file or assembly - dll from class library is not copied over to asp.net project bin folder
[英]How to access DLL in bin folder of ASP.NET MVC project?
我正在尝试使用以下内容访问项目的bin文件夹中的DLL:
[HttpPost]
public ActionResult EncryptFile()
{
Assembly SampleAssembly;
var dllFile = new FileInfo(@".\\bin\\encrypt.dll");
SampleAssembly = Assembly.LoadFile(dllFile.FullName);
//...trimmed...
}
我还尝试了var dllFile = new FileInfo(@"\\\\bin\\\\encrypt.dll");
(请注意,在文件路径前缺少.
),但是它也不起作用。 在第二种情况下,在调试器中, FullName
返回\\\\\\\\bin\\\\encrypt.dll
。
我该怎么做才能找到文件?
谢谢。
做
Assembly SampleAssembly = Assembly.LoadFile(Server.MapPath(@"~/bin/encrypt.dll"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.