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. Assembly Probing

Assembly Probing

Scheduled Pinned Locked Moved C#
helpcsharpcomwindows-adminquestion
6 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.
  • K Offline
    K Offline
    KrunalC
    wrote on last edited by
    #1

    Currently, I'm working on COM Interoperability project. In that client application (in vb 6.0) need to launch my application developed in .net. Now the problem is the assemblies referenced by my .net application is spread across 2-3 folders and not in the same folder where my .net executable is placed. Also, the client application is also not in the same path where my .net executable is. If I keep everything (i.e. .net executable and client application) in same location everything works fine but if I move my client application to location different than my .net executable path, client application fails to load. I register the assembly into the registry withoug codebase. Also, I tried setting the private path in probing attribute in app.config file but it didn't work. I want to avoid making my .net component assembly as shared assembly. Can any one pls help in how I can resolve the assembly reference issue? Thanks...

    M 1 Reply Last reply
    0
    • K KrunalC

      Currently, I'm working on COM Interoperability project. In that client application (in vb 6.0) need to launch my application developed in .net. Now the problem is the assemblies referenced by my .net application is spread across 2-3 folders and not in the same folder where my .net executable is placed. Also, the client application is also not in the same path where my .net executable is. If I keep everything (i.e. .net executable and client application) in same location everything works fine but if I move my client application to location different than my .net executable path, client application fails to load. I register the assembly into the registry withoug codebase. Also, I tried setting the private path in probing attribute in app.config file but it didn't work. I want to avoid making my .net component assembly as shared assembly. Can any one pls help in how I can resolve the assembly reference issue? Thanks...

      M Offline
      M Offline
      Mark Churchill
      wrote on last edited by
      #2

      Have a look at the AssemblyResolve event on the application domain AppDomain class. This event is called when finding an assembly location fails; you should be able to hook this and load the assembly from whatever location you like. A quick google on that event gives a few examples.

      Mark Churchill Director Dunn & Churchill

      K 1 Reply Last reply
      0
      • M Mark Churchill

        Have a look at the AssemblyResolve event on the application domain AppDomain class. This event is called when finding an assembly location fails; you should be able to hook this and load the assembly from whatever location you like. A quick google on that event gives a few examples.

        Mark Churchill Director Dunn & Churchill

        K Offline
        K Offline
        KrunalC
        wrote on last edited by
        #3

        Mark, Thanks you very much for your reply. I was looking for some direction to resolve my problem which you very well provided. However, Let me elaborate more on my problem. In my case, there are two different applications, one developed in vb 6.0 (which acts as COM client) and other in .net. Now I register my .net application with registry (using regasm tool but without using /codebase switch). Also, I don't put my .net component (which COM client will access) into GAC. So in this case when I try to access my .net component from VB application using COM, VB application fails to locate my .net component and its dependancy. Can you tell me what I should do in order to make my vb application know where my .net component is placed. If I put my vb application and .net application together, everything works fine. But if I put them seperately, loading fails with the message that "Runtime error '429'. ActiveX Comoponent can't create object.". In my vb code, I'm using CreateObject to create my .net component object. ----------------- Private Sub Command1_Click() Dim i As Object Set i = CreateObject("TestApp.class1") (TestApp.class1 is my .net component) i.ShowMessage End Sub ----------------- I hope I have explained my problem properly. if you have questions on this pls revert back. Thanks......

        M 1 Reply Last reply
        0
        • K KrunalC

          Mark, Thanks you very much for your reply. I was looking for some direction to resolve my problem which you very well provided. However, Let me elaborate more on my problem. In my case, there are two different applications, one developed in vb 6.0 (which acts as COM client) and other in .net. Now I register my .net application with registry (using regasm tool but without using /codebase switch). Also, I don't put my .net component (which COM client will access) into GAC. So in this case when I try to access my .net component from VB application using COM, VB application fails to locate my .net component and its dependancy. Can you tell me what I should do in order to make my vb application know where my .net component is placed. If I put my vb application and .net application together, everything works fine. But if I put them seperately, loading fails with the message that "Runtime error '429'. ActiveX Comoponent can't create object.". In my vb code, I'm using CreateObject to create my .net component object. ----------------- Private Sub Command1_Click() Dim i As Object Set i = CreateObject("TestApp.class1") (TestApp.class1 is my .net component) i.ShowMessage End Sub ----------------- I hope I have explained my problem properly. if you have questions on this pls revert back. Thanks......

          M Offline
          M Offline
          Mark Churchill
          wrote on last edited by
          #4

          Ah, sorry I assumed it was the .net client couldnt locate it's dependancies. I'm a bit rusty on my COM skills, have you tried checking under HKEY_CLASSES_ROOT\CLSID to see if its been registered correctly? Otherwise you might have to use the /codebase option... Good luck ;)

          Mark Churchill Director Dunn & Churchill

          K 1 Reply Last reply
          0
          • M Mark Churchill

            Ah, sorry I assumed it was the .net client couldnt locate it's dependancies. I'm a bit rusty on my COM skills, have you tried checking under HKEY_CLASSES_ROOT\CLSID to see if its been registered correctly? Otherwise you might have to use the /codebase option... Good luck ;)

            Mark Churchill Director Dunn & Churchill

            K Offline
            K Offline
            KrunalC
            wrote on last edited by
            #5

            Mark, It seems now you have understood the problem correctly. I can not use /codebase switch as my assembly is not strong named assembly (there are some issues because of which I can't make my assembly strong named). You can supply /codebase options only with the assembly which are strong named. Thanks....

            M 1 Reply Last reply
            0
            • K KrunalC

              Mark, It seems now you have understood the problem correctly. I can not use /codebase switch as my assembly is not strong named assembly (there are some issues because of which I can't make my assembly strong named). You can supply /codebase options only with the assembly which are strong named. Thanks....

              M Offline
              M Offline
              Mark Churchill
              wrote on last edited by
              #6

              Hmmm if you can't use strong naming then I'm really not sure. Maybe someone else has some ideas? :/

              Mark Churchill Director Dunn & Churchill

              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