Current directory issue to load a assembly thru reflection
-
Hi, I am trying to load a assembly thru reflection using: Assembly asm = domain.Load(AssemblyName) I understand that the assembly should also be in the currrent directory (DEBUG folder) in order to load it, though it is present in te location specified. I have tried setting a new location as my current directory before loading, using: Directory.SetCurrentDirectory(...) But still it is not loading the assembly though the dll is there in that path and NOT present in the DEBUG folder. Can anyone help me with this? Thanks, Priya.
-
Hi, I am trying to load a assembly thru reflection using: Assembly asm = domain.Load(AssemblyName) I understand that the assembly should also be in the currrent directory (DEBUG folder) in order to load it, though it is present in te location specified. I have tried setting a new location as my current directory before loading, using: Directory.SetCurrentDirectory(...) But still it is not loading the assembly though the dll is there in that path and NOT present in the DEBUG folder. Can anyone help me with this? Thanks, Priya.
-
Hi, I am trying to load a assembly thru reflection using: Assembly asm = domain.Load(AssemblyName) I understand that the assembly should also be in the currrent directory (DEBUG folder) in order to load it, though it is present in te location specified. I have tried setting a new location as my current directory before loading, using: Directory.SetCurrentDirectory(...) But still it is not loading the assembly though the dll is there in that path and NOT present in the DEBUG folder. Can anyone help me with this? Thanks, Priya.
i guess u r trying to load an assembly by specifying a path to a dll if so try the following...
System.Reflection.Assembly asmb = System.Reflection.Assembly.LoadFrom("dll path");
.....
-
i guess u r trying to load an assembly by specifying a path to a dll if so try the following...
System.Reflection.Assembly asmb = System.Reflection.Assembly.LoadFrom("dll path");
.....
Thanks for the reply. But this would load into AppDomain, I want to load into a Temporary domain which i created: AppDomain domain = AppDomain.CreateDomain("TempDomain"); Thats why i am using: domain.Load(Assemblyname)
-
I think Assembly auto searches assemblies in GAC and application folder. You'd better pass a absolute or relative path to it, rather than setting current directory... ;P
Thanks for the reply but I didn't understand where I should pass the absolute path. The statement: Assembly asm = domain.Load(asmName); does not take a path. I am trying to load into a temporary domain and not the current App Domain.
-
Hi, I am trying to load a assembly thru reflection using: Assembly asm = domain.Load(AssemblyName) I understand that the assembly should also be in the currrent directory (DEBUG folder) in order to load it, though it is present in te location specified. I have tried setting a new location as my current directory before loading, using: Directory.SetCurrentDirectory(...) But still it is not loading the assembly though the dll is there in that path and NOT present in the DEBUG folder. Can anyone help me with this? Thanks, Priya.
I'm having the same problem here. Directory.setCurrentDirectory won't work because that method is, I think, for FileBrowsers. I've tried to create the appDomain with appBasePath and appRelativeSearchPath but it still doesn't work (I get a FileNotFoundException). The Assembly is definitely in the path provided. Did you solved this? TIA Jose Tavares