質問

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:

{"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:

Use the LoadFile method to load and examine assemblies that have the same identity, but are located in different paths. LoadFile does not load files into the LoadFrom context, and does not resolve dependencies using the load path, as the LoadFrom method does.

So you should use Assembly.LoadFrom, not Assembly.LoadFile.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top