Error: The assembly "c:\MyAssembly.dll" could not be converted to a type library
Asked Answered
F

4

6

I'm trying to build my project and I've suddenly started getting the following error when the project builds and the "Register for COM interop" property is ticked.

The assembly "c:\MyAssembly.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'SomeType, MyAssembly'. Error: Referenced type is defined in managed component, which is imported from a type library that could not be loaded (type: 'OtherType'; component: 'c:\OtherAssembly.dll').

Nobody else on the team gets this error, its just me! Clearly I have done something odd to my machine, however the brute force approach of completely removing / deleting and re-adding everything I could think of made no difference, and so I am resigned to actually understanding this error (what a drag!)

So:

  • What does this error actually mean
  • Where should I look next for additional / more specific diagnostic information on what is wrong?
Foreboding answered 23/8, 2010 at 7:44 Comment(2)
1. Does the project have any external dependencies that are not configured properly on your machine? 2. What does OtherType look like?Bamako
@jgauffin, your going to need to be more specific I'm afraid - 1. My guess is yes because its broken, 2. Its an interface, other than that I'm not aware of any notable features.Foreboding
R
3

In my case, I had a com exposed dll (I changed the guid) that was registered using regasm. I had to use the following command to un-register the assembly and then I was able to build the project successfully.

c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>regasm /u "C:\some-vs-project\bin\Debug\some-vs-dll.dll"

Also if you changed the GUID you need to make sure your NOT using the same GUID in the assembly.cs that your using in your class. I used the same GUID in both the class declaration and assembly and that causes the same error as well.

Rashida answered 1/6, 2012 at 18:11 Comment(1)
Thank you, thank you, thank you! That last part about reusing the guid fixed my issues as well. :)Fuqua
E
3

I had exactly the same problem. It was fixed magically by changing the target platform from x86 to Any CPU

Eloyelreath answered 19/5, 2020 at 12:37 Comment(0)
F
2

I had this problem to. I just did the same, gactutil /u (for the uninstall) and gacutil /i (for the install) and the problem was solved

Frisket answered 8/3, 2012 at 2:1 Comment(0)
V
1

In my case, this error occured because I had manually registered a COM-server via regsvr32. When I later moved the folder containing the dll, I forgot to update the registry (i.e. unregister and re-register the COM-server).

Reregistering the server fixed the error.

Verenaverene answered 29/7, 2011 at 9:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.