search cancel

C# A2A example not working in Visual Studio 2017


Article ID: 103159


Updated On:


CA Privileged Access Manager - Cloakware Password Authority (PA) CA Privileged Access Manager (PAM)


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=, 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.'


PAM 3.x
A2A 3.x


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(); 

Additional Information

This is an addendum to this KB article #103159 pointed to by link - Using Visual Studio version VS2019, customer was running into the error below post following the steps in this KB article. 

The issue was resolved by suggestion pointed to by the link - The relevant excerpt is added as a screenshot below.