Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

.Net dll built for COM, target machine fails

Back to Forum: Tech Off
  • User profile image
    KeyboardG

    I have a C# dll built for COM and its all fine for my machine. I have a sample vm setup running just XP, .net 1.1 and 2.0 to serve as a test target machine.

    My legacy application is file-server(exe sits on network) and this cannot change. Doing things the right way I install my dll(and interop.xxx files) to C:\Docs and Settings\whatever\App Data\CompanyName\

    Now I know I need to get the class into the GAC so that my legacy app can see it over COM. I couldn't do this straight up as the gacutil isnt part of the .net runtime(so the target machine doesnt have it). I wrote a little installer/uninstaller exe which does this using System.EnterpriseServices.Internal.Publish.gacInstall().

    I made sure my dll was strongly typed via the .net command prompt doing sn -k whatever.snk and adding that to the project as the key file.

    Ok, I can browse to C:\Windows\Assembly and see my class there but my legacy app still fails when creating the object on the target machine...

    What gives? Sad

  • User profile image
    KeyboardG

    So I got it to work by cd'ing to the .net 2 directory and doing

    regasm "my full path to my dll\my.dll" /codebase

     

    Is there a downside to this? There seems to be conflicting notation/articles out there on both of these methods.

  • User profile image
    anand042008

    Dark_Halmut wrote:
    

    So I got it to work by cd'ing to the .net 2 directory and doing

    regasm "my full path to my dll\my.dll" /codebase

     

    Is there a downside to this? There seems to be conflicting notation/articles out there on both of these methods.



    Depends on what you are trying to do. Is you com app and c# dll in the same directory? If so use regasm with tlb option
    regasm <full path>.dll /tlb:<fullpath>.tlb.
     
    Don't use code base if you are going to install it in gac. More information here

    http://msdn2.microsoft.com/en-us/library/tzat5yw6(VS.71).aspx">http://msdn2.microsoft.com/en-us/library/tzat5yw6(VS.71).aspx

  • User profile image
    KeyboardG

    Thanks, I had found some stuff online that also said don't put the assembly into the gac if you plan on using it for COM. The multiple ways is a bit cloudy/confusing.

    Unfornately the legacy app using the dll sits on a network share(file-server app) but the new C# dll will sit on each users WinDisk\Docs and Setting\All Users\App Data\App Folder\

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.