2

I was working today as I do everyday, when I tried to build my project and I got this error:

Encountered multiple versions of the assembly with GUID '00020430-0000-0000-c000-000000000046'. Try pre-importing one of these assemblies.

It says the problem is in the file TlbImp that's in the root directory of my application. The only problem is that I don't have such file in my project and as far as I remember never had.

I am working with a Web Application with Visual Studio 2010 (not sure if this information helps but well, whatever).

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
gabsferreira
  • 3,089
  • 7
  • 37
  • 61
  • 1
    These days the [Microsoft connect Bug filled](http://connect.microsoft.com/VisualStudio/feedback/details/565978/tlbimp-encountered-multiple-versions-of-the-assembly-with-guid-000204ef-0000-0000-c000-000000000046) is a dead link. Yet I got the error again recently and again my solution works... but it isn't the accepted answer. – Jeremy Thompson Jan 02 '13 at 05:50

5 Answers5

6

Thanks @DavRob but it wasn't the answer I was looking for. @dev_Gabriel I managed to fix it, here are the steps that worked for me:

  1. In Visual Studio right click on Project
  2. Select Properties
  3. Select the references tab.
  4. Check to see if any of the references are from the obj\Debug folder and remove them.
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
2

There is a Microsoft connect Bug filled for that

It said that there a problem with a reference to an COM component.

This was fixed and should be available in a future release of Visual Studio.
(Note: This did not make it into SP1.)

Tlbimp is the Type Library Importer. Visual Studio use it to generate the interop assembly of references to COM libraries you added.

DavRob60
  • 3,517
  • 7
  • 34
  • 56
  • Thank you! Apparently there's no way to fix it but reinstalling Visual Studio or something like that. Thanks again. – gabsferreira May 09 '11 at 12:21
  • 1
    For the ones who are reading this question, the Microsoft Connect Bug link is dead and @JeremyThompson has another solutions that might solve this problem. – gabsferreira Jan 03 '13 at 14:43
1

Just to add to @JeremyThompson's response:

My issue was due to referencing a COM object, by going "Add Reference" and browsing to the the .exe for the application (i.e. C:\Program Files (x86)\ProFile\profile.exe). This added an "Interop.Profile.dll" (obviously this will be different depending on the SDK you're trying to access) reference which was located in the obj/Debug folder as described by @JeremyThompson.

In my specific case, I had this Interop.Profile.dll referenced in two projects, one of which was not getting the error above and built successfully. I went to the obj/Debug folder for the successfully built project and copied the Interop.Profile.dll to my Solution's DLL folder (this is just a folder I created to keep all of my assemblies in one place, but you could technically put your COM DLL anywhere outside of the obj/Debug folder) and then changed the references of both my projects to point at the Interop.Profile.dll which is located in my DLLs folder, rather than the one in the obj/Debug folder.

Once I did this, my application built successful (using Rebuild, or Clean and then Build).

Obviously, my case is pretty specific, but hopefully it helps someone out there.

crunchy
  • 246
  • 1
  • 3
  • 12
0

I just had this today when migrating a VS 2008 project to VS 2013, with another different twist. Took me a while to figure out, so it might help someone else. I have a solution with 10 or so projects in it. One of the projects is VB which references an old OCX with a GUI. To create the required interop references, you need to drag the OCX onto a Winform which pulls in other references as well as creating the required AX interop ref. All these interop dlls are are created in in the ...\obj\debug\ path. I was getting several "multiple version" errors, but not from the project with the COM references but from another C# project that referenced the VB project. To get rid of this, I copied the interop files created by the VB project to the ...\obj\debug\ folder of the C# project. It's a bit of a pain, since each time you clean the project, you need to re-copy the files, but at least it works now. Note that you cannot move the AxInterop somewhere else and referecne irmanually reference it as it screws thing sup a treat. Thanks @crunchy for giving me the idea.

PabloInNZ
  • 515
  • 4
  • 14
0

I had the same error. I realised that I was referencing the same .dll twice in two different locations.

So all I did was delete all the references to the .dll, and added it again from a single location.

This resolved the error.