简体   繁体   English

RunTimeMethodInfo GetParameters异常

[英]RunTimeMethodInfo GetParameters Exception

I am checking for an assembly through: 我正在通过以下方式检查组装:

var asm = Assembly.LoadFile

and I am accessing to a specific type and I'm trying to get the parameters of a specific method. 并且我正在访问特定类型,并且试图获取特定方法的参数。

The problem is that some of the parameters Type is defined in another assembly and this method throws me an exception saying that cannot find the assembly: 问题在于某些参数Type是在另一个程序集中定义的,此方法使我抛出异常,无法找到该程序集:

{"Could not load file or assembly 'project.POCO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"project.POCO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}

How can I set up to this run OK? 我如何设置此运行正常? Everyone? 大家?

Thanks :) 谢谢 :)

As MSDN states : 正如MSDN所述

Use the LoadFile method to load and examine assemblies that have the same identity, but are located in different paths. 使用LoadFile方法可以加载和检查具有相同标识但位于不同路径中的程序集。 LoadFile does not load files into the LoadFrom context, and does not resolve dependencies using the load path , as the LoadFrom method does. LoadFile不会将文件加载到LoadFrom上下文中, 也不会像LoadFrom方法那样使用加载路径解析依赖项

So you should use Assembly.LoadFrom , not Assembly.LoadFile . 因此,您应该使用Assembly.LoadFrom ,而不是Assembly.LoadFile

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM