Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Loading vjslib dynamically

Loading vjslib dynamically

Scheduled Pinned Locked Moved C#
csharpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gareth H
    wrote on last edited by
    #1

    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"); and Assembly.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)

    K 1 Reply Last reply
    0
    • G Gareth H

      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"); and Assembly.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)

      K Offline
      K Offline
      Karmendra Suthar
      wrote on last edited by
      #2

      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

      G 1 Reply Last reply
      0
      • K Karmendra Suthar

        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

        G Offline
        G Offline
        Gareth H
        wrote on last edited by
        #3

        KSuthar, That still doesn't get around the problem of having a hard coded path.

        Regards, Gareth. (FKA gareth111)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups