none
Resolving Mixed mode assembly issue RRS feed

  • Question

  • Although I have already received answere to one part of issue from below post

    http://social.msdn.microsoft.com/Forums/en/clr/thread/9a3b7738-dd71-4532-9e3a-6c7f50e18b30

    the other part follows here:

    Windows SDK\v6.0A\tlbimp.exe was used to generated interop.dlls(Runtime version v2.0) from .tlb files. When these interop.dlls are used in a VS2010 environment along with other dlls(Runtime version .net 4.0) it resulted in exception:
                 "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information."

    Performing the above operation with Windows SDK\v7.0A\tlbimp.exe also resulted in same exception.

    I have installed Windows SDK v8.0 but \tlbimp.exe was not found.
            1. why??
            2. How to generate interop.dlls(Runtime version v4.0) using tlbimp.exe??

    While adding .tlb files directly into VS2008/VS2010 C# project references, some of them report issue:
               Please verify that file is accessible and a valid assembly or COM component. 

              1. What is going wrong here?

              2. How to resolve this issue without using interop.dll files from tlbimp.exe

    Thursday, January 10, 2013 8:42 AM

Answers

  • Hi There,

    We are talking about the tool tibimp in this case, and this tool run fine in "Visual Studio Command Prompt", so please try above way first.

    Thank you.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 14, 2013 4:52 AM
    Moderator
  • Hi there,

    Nice to see you.

    >>I have installed Windows SDK v8.0 but \tlbimp.exe was not found. 
            1. why??
            2. How to generate interop.dlls(Runtime version v4.0) using tlbimp.exe??

    Please follow this way: http://msdn.microsoft.com/en-us/library/tt0cf3sx(v=vs.110).aspx  

    To run the tool, we recommend that you use the Visual Studio Command Prompt or the Windows SDK Command Prompt (CMD Shell). These utilities enable you to run the tool easily, without navigating to the installation folder. For more information, see Visual Studio and Windows SDK Command Prompts.

    >>Please verify that file is accessible and a valid assembly or COM component. 

              1. What is going wrong here?

              2. How to resolve this issue without using interop.dll files from tlbimp.exe

    A short answer: .tlb is for native code. Please do not use it in your C# project. It is generated by impexp from Assembly.

    I hope this is clear.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 11, 2013 8:01 AM
    Moderator

All replies

  • Hi there,

    Nice to see you.

    >>I have installed Windows SDK v8.0 but \tlbimp.exe was not found. 
            1. why??
            2. How to generate interop.dlls(Runtime version v4.0) using tlbimp.exe??

    Please follow this way: http://msdn.microsoft.com/en-us/library/tt0cf3sx(v=vs.110).aspx  

    To run the tool, we recommend that you use the Visual Studio Command Prompt or the Windows SDK Command Prompt (CMD Shell). These utilities enable you to run the tool easily, without navigating to the installation folder. For more information, see Visual Studio and Windows SDK Command Prompts.

    >>Please verify that file is accessible and a valid assembly or COM component. 

              1. What is going wrong here?

              2. How to resolve this issue without using interop.dll files from tlbimp.exe

    A short answer: .tlb is for native code. Please do not use it in your C# project. It is generated by impexp from Assembly.

    I hope this is clear.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, January 11, 2013 8:01 AM
    Moderator
  • Thanks Mark for you reply.

    http://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspx

    states that The Windows SDK no longer ships with a complete command-line build environment. The Windows SDK now requires a compiler and build environment to be installed separately.

    So looks like i need to install next version of visual studio which is compatible to SDK 8.0.

    Friday, January 11, 2013 12:11 PM
  • Hi There,

    We are talking about the tool tibimp in this case, and this tool run fine in "Visual Studio Command Prompt", so please try above way first.

    Thank you.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 14, 2013 4:52 AM
    Moderator
  • Thanks again Mike,

    It is definitely generating .net 4.0 interop files when using from VS2010 cmd prompt. With this, now I'm able to generate the interop files to be used in C# projects built using VS2010 and .net 4.0.

    I would like to know, is it possible to launch the VS2010 cmd prompt from a batch file or a C# application?? I need this, because there is a huge bunch of .tlb file with "different /verbose and /tlbreference:" as arguments that needs to be generated.

    Any inputs is really helpful.

    Tuesday, January 15, 2013 1:40 PM
  • Hi there,

    Yes, it does.

    When you right click on the VS2010 cmd prompt, and go to the property tab. you can found the start parameters:

    %comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

    I hope this will be helpful.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, January 16, 2013 1:52 AM
    Moderator