Loading a weak name assembly from AppBase

164 Views Asked by At

I want to load a assembly at run time. And the only information which I know about the assembly is its name (weak name). I have read in one of the books that all assembly with weak name are present in AppBase. Does anyone know how I can load this assembly at run time ?

The code which I found on net was loading the assembly If you know the Assembly Path. But I don't want to hard code the path.

I am using the below code to load an assembly. Assembly assembly = Assembly.Load("RomanConverter"); Now when the CLR tries to load the assembly it cannot find the assmbly. Reason is the above line of code is invoked by a console application which does not have any reference to Roman Converter. It tries to find the assembly in below locations: (Fusion Log)

LOG: Attempting download of new URL file:///C:/Users/XYZ/documents/visual studio 2010/Projects/Algo/Algo/bin/Debug/RomanConerter.DLL. LOG: Attempting download of new URL file:///C:/Users/XYZ/documents/visual studio 2010/Projects/Algo/Algo/bin/Debug/RomanConerter/RomanConerter.DLL. LOG: Attempting download of new URL file:///C:/Users/XYZ/documents/visual studio 2010/Projects/Algo/Algo/bin/Debug/RomanConerter.EXE. LOG: Attempting download of new URL file:///C:/Users/XYZ/documents/visual studio 2010/Projects/Algo/Algo/bin/Debug/RomanConerter/RomanConerter.EXE.

But my assembly is present in some other location. (Imp: I can't har d code the path here or I don't want to give any relative path)

0

There are 0 best solutions below