none
Could not load type 'xxxxx' from assembly when using tlbimp.exe RRS feed

  • Question

  • hello all, 

    i have a .net 2.0 project using vs2008. the project uses a com dll. a reference is added to the project. when i set the 'copy local' flag of the reference to true, the program works fine and using the com dll.

    but (of coarse) that's not what i want. i would like to set the copy local flag to false, so that the interop dll of the com dll is not generated by visual studio and i can load the interop dll from another location. therefor i created a assembly resolver, and that works fine. when move the interop dlls created by vs2008 (when the 'copy local' file was set to true) to somewhere the resolver will load the assemblies correctly.

    but, i don't want to use vs2008 to generate the interop dll, but tlbimp.exe. and there it goes wrong. building the interop dll works, but when starting the program, i get the error 

    Could not load type 'xxxxLib.IAAACallback' from assembly 'Interop. xxxxLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

    No idea how to solve. 

    Please Help, 

    Thanks !

    Friday, May 7, 2010 4:12 PM

Answers

  • Is the type really in your tlbimp'd interop assembly? (use ildasm or Reflector) Does the exception have inner exception? Are you sure that the assembly is loaded? (Check fusion log - fuslogvw.exe, or debugger)

    BTW: VS uses tlbimp inder the hood, so try to compare the 2 interop assemblies generated by you and by VS - is there any difference? (Use "ildasm your.dll /out=out.il" and compare the IL files)

    -Karel

    Sunday, May 9, 2010 10:26 PM
    Moderator
  • Karel,

    thanks for the hints. using ildasm i saw the problem (/out option was used which created a namespace which i didn't expected). 

    Regards, 

    Andijvie

    • Marked as answer by andijvie Monday, May 10, 2010 5:53 PM
    Monday, May 10, 2010 5:53 PM

All replies

  • Is the type really in your tlbimp'd interop assembly? (use ildasm or Reflector) Does the exception have inner exception? Are you sure that the assembly is loaded? (Check fusion log - fuslogvw.exe, or debugger)

    BTW: VS uses tlbimp inder the hood, so try to compare the 2 interop assemblies generated by you and by VS - is there any difference? (Use "ildasm your.dll /out=out.il" and compare the IL files)

    -Karel

    Sunday, May 9, 2010 10:26 PM
    Moderator
  • Karel,

    thanks for the hints. using ildasm i saw the problem (/out option was used which created a namespace which i didn't expected). 

    Regards, 

    Andijvie

    • Marked as answer by andijvie Monday, May 10, 2010 5:53 PM
    Monday, May 10, 2010 5:53 PM