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. .NET (Core and Framework)
  4. regasm fails, cannot load type

regasm fails, cannot load type

Scheduled Pinned Locked Moved .NET (Core and Framework)
comhelpcsharpoop
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.
  • S Offline
    S Offline
    Steven Campbell
    wrote on last edited by
    #1

    I have a .NET DLL that has the following inheritance structure (each object inherits from the object above it): BaseObject (VB6 COM DLL) COM Interop DLL (.NET) Abstract BaseObject (.NET) Abstract BaseObject2 (.NET) Concrete Object (.NET) To complicate matters, the Concrete .NET Class needs to be accessible from COM. I have set the appropriate attributes to make this happen, and everything works fine on my machine, and some others too. To register on another machine, I use RegAsm. However, on some XP machines, regasm is failing, with the error: RegAsm error: Could not load type XX.XX.AppBase from assembly XX.XX.XX, Version=0.9.1616.28364, Culture=neutral, PublicKeyToken=null because the format is invalid. where XX.XX.AppBase is the first abstract base object. All machines are running .NET 1.1. I have tried to work around the problem by using .reg files to register the DLL, but that just defers the error message until the application tries to use the object. Has anyone any ideas on how I can resolve this, or what causes it?

    K 1 Reply Last reply
    0
    • S Steven Campbell

      I have a .NET DLL that has the following inheritance structure (each object inherits from the object above it): BaseObject (VB6 COM DLL) COM Interop DLL (.NET) Abstract BaseObject (.NET) Abstract BaseObject2 (.NET) Concrete Object (.NET) To complicate matters, the Concrete .NET Class needs to be accessible from COM. I have set the appropriate attributes to make this happen, and everything works fine on my machine, and some others too. To register on another machine, I use RegAsm. However, on some XP machines, regasm is failing, with the error: RegAsm error: Could not load type XX.XX.AppBase from assembly XX.XX.XX, Version=0.9.1616.28364, Culture=neutral, PublicKeyToken=null because the format is invalid. where XX.XX.AppBase is the first abstract base object. All machines are running .NET 1.1. I have tried to work around the problem by using .reg files to register the DLL, but that just defers the error message until the application tries to use the object. Has anyone any ideas on how I can resolve this, or what causes it?

      K Offline
      K Offline
      klawipo
      wrote on last edited by
      #2

      Sometimes I had similiar problems using RegAsm. I don't know whether they help, but I have a few advices: -Clear all Registry Entries made from previous attempts to register your Assembly (search the registry e.g. for the dll-names or UUIDs if any are given in your Code). -If not already done, type an unique Versionnumber in 'AssemblyInfo.cs' (Important: Don't leave any '*' in the Versionnumber. The '*' shall cause the VS to generate a Versionnumber. I think it's the Buildnumber. But this simply doesn't work correctly, s.t. regasm may try to register a seemingly older version over a newer one.) - If it still doesn't work: Try to 'export' as few symbols as possible. That means (in C#): Use 'public' only on functions that are used by other dlls or via com (e.g. implemented Interface-functions must be public). Use 'internal' for other functions instead. As far as I understood, public in C# is for com like dllexport in C. Please tell me if any of the advices helped.

      S 1 Reply Last reply
      0
      • K klawipo

        Sometimes I had similiar problems using RegAsm. I don't know whether they help, but I have a few advices: -Clear all Registry Entries made from previous attempts to register your Assembly (search the registry e.g. for the dll-names or UUIDs if any are given in your Code). -If not already done, type an unique Versionnumber in 'AssemblyInfo.cs' (Important: Don't leave any '*' in the Versionnumber. The '*' shall cause the VS to generate a Versionnumber. I think it's the Buildnumber. But this simply doesn't work correctly, s.t. regasm may try to register a seemingly older version over a newer one.) - If it still doesn't work: Try to 'export' as few symbols as possible. That means (in C#): Use 'public' only on functions that are used by other dlls or via com (e.g. implemented Interface-functions must be public). Use 'internal' for other functions instead. As far as I understood, public in C# is for com like dllexport in C. Please tell me if any of the advices helped.

        S Offline
        S Offline
        Steven Campbell
        wrote on last edited by
        #3

        The problem turned out to be that my DLL exposed an ADO recordset. This was not a problem on machines with Visual Studio.NET installed, because they have ADODB.DLL in the GAC. However, most user machines do not. So the solution was to copy ADODB.DLL from my local machine (C:\Program Files\Microsoft.NET\Primary Interop Assemblies\ADODB.DLL) to the target machine, and then install it to the GAC (gacutil -i ADODB.DLL).

        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