Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 c# reflection loading reference, fail to load reference of reflection

views
     
TSragk
post Apr 15 2016, 06:48 PM, updated 8y ago

BooBoo~
*******
Senior Member
2,265 posts

Joined: Apr 2009


Hi All,

I had an application using reflection method to load A.dll from specific path. The application successfully to load A reference, but when A trying to call B reference (which is same path with A), it failed.
"Could not load file or assembly 'B, Version=3.1.0.1001, Culture=neutral, PublicKeyToken=null' or one of its dependencies"
A referenced B by using normal right click and add method, and that's some other .dll come along with B and successfully loaded by A, any idea?
p/s B definitely working well, that's some other project calling using right click + add method and worked without issue, it only has problem if it was called via reflection
TSragk
post Apr 18 2016, 05:48 PM

BooBoo~
*******
Senior Member
2,265 posts

Joined: Apr 2009


solution found, in-case someone googling and reach here.
use Assembly.LoadFrom instead of Assembly.LoadFile for the reflection.
angch
post Apr 18 2016, 05:52 PM

On my way
****
Junior Member
635 posts

Joined: Jul 2006
QUOTE(ragk @ Apr 18 2016, 05:48 PM)
solution found, in-case someone googling and reach here.
use Assembly.LoadFrom instead of Assembly.LoadFile for the reflection.
*
Thanks! https://xkcd.com/979/

 

Change to:
| Lo-Fi Version
0.0105sec    0.59    5 queries    GZIP Disabled
Time is now: 28th March 2024 - 09:21 PM