Solving LNK2022 error: Duplicate Managed type have different visibilities RRS feed

  • Question

  • Hello All!

    I don't know if this problem has been solved and published somewhere but I can't find help. Any idea?

    I'm porting a .NET solution from MSVS2005 to MSVS2012. I have the LNK2022: metadata operation failed (801311E4) for a file in a project that built perfectly under 2005 and 2010. I don't know what to do. I cannot find any clue on the net. Someones suggested me to use idlasm but I don't know what to do exactly.

    Need some help please!


    Monday, October 1, 2012 2:03 PM

All replies

  • This forum supports the Help System built into Visual Studio.

    You appear to have an issue upgrading a VS 2005 solution to VS 2012, but you don't mention the project type(s) or which programming language is involved.

    The experts in the developer forums will probably be able to help you best. Please select the link below that applies to you.

    For VB: http://social.msdn.microsoft.com/Forums/en-US/category/visualbasic

    For C#: http://social.msdn.microsoft.com/Forums/en-US/category/visualcsharp

    For C++: http://social.msdn.microsoft.com/Forums/en-US/category/visualc

    Monday, October 1, 2012 8:36 PM
  • You may want to read this http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/553600da-3327-490a-ba9f-88fe0d402754

    If you use make_public this may be the cause of your problem. The solution I used is to create a header file containing all my make_public's and always include this first in every file. I also found that code that compiled/linked OK in VS 10 using this broke in VS 12 which seems to echo your issue

    So rather than fix the real problem MS seem to have altered things slightly so that you can break in slightly different ways on the two compilers. Shame MS don't spend a bit less time on marketing and a bit more fixing well documented know bugs in their products.

    Thursday, December 13, 2012 10:19 PM