The “Event invocation for COM objects requires event to be attributed with DispIdAttribute” error message appears in Visual Studio 2010, .NET 4.0.
This issue doesn’t occur in .NET 2.0.
Reason
When a new Reference (Interop.FCEngine) is added to the References list, VS 2010 and .NET 4.0 may automatically set the value of the Embed Interop Types property of the new Reference to TRUE. This property was introduced as a way to overcome the difficulties associated with deploying Primary Interop Assemblies (for more information see http://blogs.msdn.com/b/samng/archive/2010/01/24/the-pain-of-deploying-primary-interop-assemblies.aspx).
The default setting for this property in .NET 2.0 is FALSE, which is why you don’t receive any error messages when you run the Test application in .NET 2.0.
When a new Reference (Interop.FCEngine) is added to the References list, VS 2010 and .NET 4.0 may automatically set the value of the Embed Interop Types property of the new Reference to TRUE. This property was introduced as a way to overcome the difficulties associated with deploying Primary Interop Assemblies (for more information see http://blogs.msdn.com/b/samng/archive/2010/01/24/the-pain-of-deploying-primary-interop-assemblies.aspx).
The default setting for this property in .NET 2.0 is FALSE, which is why you don’t receive any error messages when you run the Test application in .NET 2.0.
Solution
You need to check your Embed Interop Types flag:
- Click on the FCEngine reference;
- In the Properties pane, change "Embed Interop Types" to False.
You need to check your Embed Interop Types flag:
- Click on the FCEngine reference;
- In the Properties pane, change "Embed Interop Types" to False.
Comments
1 comment
Vladimir Torres
Thanks for your help, That's exactly what I was looking for!. This fix my trouble with the events and COM object.
Please sign in to leave a comment.