none
How to assign "Company name" to Inerop dll? RRS feed

  • Question

  •  I deveploped a application using c#, this application call a COM dll. In order to communicate with COM object,  I use sdk tool Tlbimp.exe to generate a interop dll named Interop.fsrguiLib.dll(fsrguiLib is a COM dll).  Tlbimp.exe only can assign the version infomation to Interop.fsrguiLib.dll, but can not assign "Company name","Product name" to Interop.fsrguiLib.dll, so our application can not pass Windows Vista/2008 certification, it need completed infomation( "Version info","Company name","Product name") for each dll and exe. How could I solve this issue?
    Thursday, June 19, 2008 6:00 AM

Answers

  • You'll need a .res file that contains the compiled version of a file version resource.  The easiest way to make one is to create a class library project and edit the AssemblyInfo.cs file the way you want it.  Compile the project.  I'll assume you named it ClassLibrary1.  Then start the VS command line prompt and type

    cd \projects\classlibrary1\obj\debug
    ildasm classlibrary1.dll /out:classlibrary1.il

    That creates two files, classlibrary1.res is the one you want.  Copy it to the directory that contains the interop DLL.  Then:

    ildasm interop.blabla.dll /out:interop.blabla.il
    ilasm interop.blabla.il /dll /resource:classlibrary1.res

    You'll need to use the /key command line option for ilasm if the interop assembly was strong-named.

    Hans Passant.
    • Marked as answer by sutton sun Friday, June 20, 2008 2:09 AM
    • Marked as answer by sutton sun Friday, June 20, 2008 2:09 AM
    • Marked as answer by sutton sun Friday, June 20, 2008 2:12 AM
    Thursday, June 19, 2008 2:11 PM
    Moderator

All replies

  • All I can think of is to build your own TlbImp replacement (pretty easy to do with the TypeLibConverter class), and embed a resource with the version info using ModuleBuilder.DefineUnmanagedResource. Haven't tested this myself but it's worth a try.

    Another option might be to use a tool (if you can find one) that can modify the version resource after the assembly has been created by TlbImp.

    Mattias, C# MVP
    Thursday, June 19, 2008 7:11 AM
    Moderator
  • You'll need a .res file that contains the compiled version of a file version resource.  The easiest way to make one is to create a class library project and edit the AssemblyInfo.cs file the way you want it.  Compile the project.  I'll assume you named it ClassLibrary1.  Then start the VS command line prompt and type

    cd \projects\classlibrary1\obj\debug
    ildasm classlibrary1.dll /out:classlibrary1.il

    That creates two files, classlibrary1.res is the one you want.  Copy it to the directory that contains the interop DLL.  Then:

    ildasm interop.blabla.dll /out:interop.blabla.il
    ilasm interop.blabla.il /dll /resource:classlibrary1.res

    You'll need to use the /key command line option for ilasm if the interop assembly was strong-named.

    Hans Passant.
    • Marked as answer by sutton sun Friday, June 20, 2008 2:09 AM
    • Marked as answer by sutton sun Friday, June 20, 2008 2:09 AM
    • Marked as answer by sutton sun Friday, June 20, 2008 2:12 AM
    Thursday, June 19, 2008 2:11 PM
    Moderator
  •  Thanks both of you, I have fixed this issue with Hans suggestion, it is simple and useful.
    Friday, June 20, 2008 2:12 AM