HiveBrain v1.2.0
Get Started
← Back to all entries
debugcsharpCritical

Interop type cannot be embedded

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
cannotembeddedtypeinterop

Problem

I am creating a web application on the .NET 4.0 framework (beta2) in C#.

When I try to use a assembly called "ActiveHomeScriptLib", I get the following error:


Interop type
'ActiveHomeScriptLib.ActiveHomeClass'
cannot be embedded. Use the applicable
interface instead.

When I change the framework to version 3.5, I don't have any errors.

What is an Interop Type and why does this only occur when I use the 4.0 framework?

Solution

.NET 4.0 allows primary interop assemblies (or rather, the bits of it that you need) to be embedded into your assembly so that you don't need to deploy them alongside your application.

For whatever reason, this assembly can't be embedded - but it sounds like that's not a problem for you. Just open the Properties tab for the assembly in Visual Studio 2010 and set "Embed Interop Types" to "False".

EDIT: See also Michael Gustus's answer, removing the Class suffix from the types you're using.

Context

Stack Overflow Q#2483659, score: 1180

Revisions (0)

No revisions yet.