开发者

Assembly error building app - Encountered multiple versions of assembly

开发者 https://www.devze.com 2023-03-04 09:31 出处:网络
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

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 o开发者_如何学Gonly 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).


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.


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.


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消