无法使用assembly.loadfrom加载程序集

编程入门 行业动态 更新时间:2024-10-28 13:29:07
本文介绍了无法使用assembly.loadfrom加载程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

public static IDashboardService CreateDataAccessLayer() { //string classname = path + ".DashboardFactoryService"; var assembly = Assembly.LoadFrom("Dashboard.dll"); return (IDashboardService)(Assembly.Load(path).CreateInstance(classname)); }

我正在尝试加载程序集Dashboard.dll,这是同一解决方案中的一个项目。 /> 但是当我使用Assembly.LoadFrom()时出现以下错误

I am trying to load the assembly Dashboard.dll, which is a project in the same solution. But when I use Assembly.LoadFrom() I get the following error

An exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll but was not handled in user code Additional information: Could not load file or assembly 'file:///C:\Program Files (x86)\IIS Express\Dashboard.dll' or one of its dependencies. The system cannot find the file specified.

我尝试了什么: 我尝试在当前项目中添加Dashboard项目的引用。 我也尝试使用 < runtime> < assemblybinding xmlns =urn:schemas-microsoft-com:asm.v1> < probing privatepath =bin; bin2> 但不包括work

What I have tried: I have tried adding the reference of Dashboard project in current project. I also tried loading it from bin folder using <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <probing privatepath="bin;bin2"> but does not work

推荐答案

Assembly.LoadFrom()需要完整路径,例如C:\\folder\\filename.dll:Assembly.LoadFrom Method(String)(System.Reflection) [ ^ ] Assembly.LoadFrom() requires a full path e.g. "C:\\folder\\filename.dll" : Assembly.LoadFrom Method (String) (System.Reflection)[^]

更多推荐

无法使用assembly.loadfrom加载程序集

本文发布于:2023-11-13 11:46:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584278.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:加载   程序   assembly   loadfrom

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!