When attempting to build/compile the A2A Example for C#_64 in Visual Studio 2017 with .Net version 4.0, Visual Studio throws the following error:
System.BadImageFormatException: 'Could not load file or assembly 'Interop.Cspmclientc64, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.'
Environment
PAM 3.x A2A 3.x
Resolution
The error that is due to the fact that we cannot find the file:
Inside the sample same code, we state that you must:
// To use the CSPM DLL, first add a reference to the DLL. // To do this, select Project, Add Reference // Select the COM tab // Select Browse // Select the Cspmclientc64. // Click Open // Click OK
Additionally for Visual Studio 2017 with .NET version 4, the code must be updated to:
Cspmclientc64.ccspmclientc64 c = new Cspmclientc64.ccspmclientc64(); instead of: Cspmclientc64.ccspmclientc64class c = new Cspmclientc64.ccspmclientc64class();