Error when using Inventor classes from a separate dll

<?xml encoding=”UTF-8″>By Adam Nagy

When you have a standalone application you may want to place some of the functionality in a separate dll.

EmbeddedType

In this case if you create classes which are derived somehow from an Inventor class and try to use those from your main application then you’ll get an error:

"Error   1   Type 'Classes_Inventor.Collection_Axes' from assembly
'c:UsersAdministratorDocumentsVisual Studio 2010Projects
InventorTestConsoleClasses_InventorbinDebugClasses_Inventor.dll'
cannot be used across assembly boundaries because a type in its
inheritance hierarchy has a generic type parameter that is an
<strong>embedded interop type</strong>.
c:usersadministratordocumentsvisual studio 2010
ProjectsInventorTestConsoleInventorTestConsoleProgram.cs
12  29  InventorTestConsole"

The highlighted words provide a clue about the solution, which is the same as shown in this article:
http://modthemachine.typepad.com/my_weblog/2012/07/set-embed-interop-types-to-false-to-avoid-problems-with-events.html

Once we changed Embed Interop Types property of the reference to Inventor in the dll to False, the whole project compiled fine.

 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading