AnsweredAssumed Answered

Sample for create Add-in does not work

Question asked by Mo Bria on Jun 7, 2017
Latest reply on Jan 2, 2018 by Andri Olafsson

I try to build my first Add-in for PDM Professional. I use the following sample: 2016 SOLIDWORKS API Help - Creating Add-ins (C#)

Until point 22 everything works correctly and I think I have done everything correctly.

At point 23 when I click on the tresor and right click on it an click on the Add-in on the context menu, I receive the following bug:

"Managed Debugging Assistant 'InvalidMemberDeclaration' has detected a problem in C:\...\notepad.exe" and the following bug which is in German:

"Fehler beim Bestimmen der Marshallingmethode für die Parameter des "OnCmd"-Members vom Typ "EdmLib.IEdmAddIn5": System.TypeLoadException: Der Typ "EdmLib.EdmCmdData" in der Assembly "TestSolidworks, Version=, Culture=neutral, PublicKeyToken=null" konnte nicht geladen werden.. Mögliche Ursache: Nicht kompatibles MarshalAs-Attribut für einen der Parameter."

which means something like "Error in defining the marshall method of the parameters of OnCmd Member of type EdmLib.IEdmAddIn5: System.TypeLoadException: The type of EDMLib.EdmCmdData of assembly TestSolidworks, version=, culture=neutral, publickeytoken=null cannot be loaded. Possible reason: Not compatible MarshalAs-Attribut of one of the parameters"

What have I to change?