Loading vjslib dynamically
-
I am using a 3rd party DLL that uses the J# runtime. If J# isnt installed, i get a FileIO exception. I want to be able to check when my program starts up if J# is installed, I think the best way is to load the assembly, if its found, then carry on, if not, notify the user. I tried:
Assembly.Load("vjslib");
andAssembly.Load("vjslib.dll");
but both throw not found exceptions. The below works fine, but that means the path is hard coded. Is it possible to get the DLL's location dynamically?string path = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\vjslib.dll";
Assembly assembly = Assembly.LoadFile(path);Regards, Gareth. (FKA gareth111)
-
I am using a 3rd party DLL that uses the J# runtime. If J# isnt installed, i get a FileIO exception. I want to be able to check when my program starts up if J# is installed, I think the best way is to load the assembly, if its found, then carry on, if not, notify the user. I tried:
Assembly.Load("vjslib");
andAssembly.Load("vjslib.dll");
but both throw not found exceptions. The below works fine, but that means the path is hard coded. Is it possible to get the DLL's location dynamically?string path = "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\vjslib.dll";
Assembly assembly = Assembly.LoadFile(path);Regards, Gareth. (FKA gareth111)
Just a thought, try if you can write a small search routine and search the dll in %systemroot%\\Microsoft.NET\\ If J# runtime is installed is it definite to have the dll in C:\WINDOWS\system32\? If yes use %systemroot%\\system32\\vjslib.dll
string path = "%systemroot%\\Microsoft.NET\\Framework\\v2.0.50727\\vjslib.dll";
Assembly assembly = Assembly.LoadFile(path);regards Karmendra
-
Just a thought, try if you can write a small search routine and search the dll in %systemroot%\\Microsoft.NET\\ If J# runtime is installed is it definite to have the dll in C:\WINDOWS\system32\? If yes use %systemroot%\\system32\\vjslib.dll
string path = "%systemroot%\\Microsoft.NET\\Framework\\v2.0.50727\\vjslib.dll";
Assembly assembly = Assembly.LoadFile(path);regards Karmendra