I would like to start looking into integrating the API into some software I'm working on. Basically I am hoping someone can help me with using the sample code at https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS161216. When I try to include mksapi.dll as a reference in my project, I get an error "A reference to 'mksapi.dll' could not be added." I don't have the Visual Studio integration setup but I was under the impression (maybe incorrectly) that this wouldn't be required. Has anyone encountered this before and found a solution?
Solved! Go to Solution.
The source of my problem was what I defined in the app capabilities. This is something unique to WIndows RT apps. I had the Internet (Client) capability selected but I did not have Private Networks (Client & Server)selected. Because of this my app could not talk to the Integrity server but because of my unfamiliarity with the API, I had trouble tracking down the issue.
Since Visual Studio 2013 Express isn't one of the versions supported for the Visual Studio Integration, I had to set it up a bit differently. Here's how:
I was then able to use the sample code at: https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS159452. The only edit that I had to make was to use APIFactory.CreateIntegrationPointinsted of APIFactory.CreateLocalIntegrationPoint since I am running this on a remote machine and not the server.
I haven't done too much yet so I don't know whether or not this is really a full integration. So far I have only used the sample code to get a reply. I am hopeful that this will be the correct solution though.
Hello Nolin, We haven't recently had anything like that reported, and I have never run into that myself. Maybe someone else has run into something similar? Regards, Kael
Dependency Walker is telling me that the below dlls are not found (and mksapi.dll is dependent on them). I think this may be a Windows 8.1 thing. I'm trying to figure it out now.
It looks like instead of adding the dll as a reference, you are just supposed to include it as an existing item. The Visual Studio Integration looks like it may be quite a bit simpler so I think I may just go that route instead.
Apparently the Visual Studio Integration only works with old versions of Visual Studio. Is there any plan to update this?
Here is where I am at after trying for a while to get this to work. To get the reference into my project, I extracted MKS.ManagedAPI.dll from the msi for Visual Studio Integration. This is because it cannot be installed with my version which is Visual Studio Express 2013. I added it as a reference. None of the other dlls could be added as they would all cause problems when it tried to compile. They all seem to rely on dlls for Windows desktop applications. I then included a bunch of the dlls from the client folder (including mksapi.dll) in the project instead of adding them as references. I have been working off of the sample code at https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS159452. When I try to run the code, I get the below error when the cmd tries to execute at cr.Execute(cmd). Does anyone have any idea how to get around this issue? Is there any way to tell if I am even able to communicate with the server?
Message: API communications error
at MKS.ManagedAPI.CmdRunner.RawExecute(Command cmd, ExecutionType execType)
at MKS.ManagedAPI.CmdRunner.Execute(Command cmd)
One thing that may be relevant; I had to use APIFactory.CreateIntegrationPoint instead of CreateLocalIntegrationPoint because it would use 127.0.0.1 instead of the correct server address. This allowed me to directly specify the server address.
Hi Nolin, please find mksapi.dll mksapi.lib mksapi64.lib under <integrity client installation path>\bin, then add them into your microsoft visual studio project as reference and dependency.
I have them all included by adding them with Right Click>Add>Existing Item but if I try to add mksapi.dll as a reference, I get the error in my original post.
Correction: I get this error when I try to add mksapi.dll as a reference
My previous reply was for C API.
For C# API, MKS.ManagedAPI.dll from Integrity Visual Studio Integration is what you need, but unfortunately Microsoft Visual Studio 2013 was NOT tested.
And when I say "add reference" it didn't mean add the files as "Exsiting Item", it means:
How to: Add or Remove References By Using the Add Reference Dialog Box
Above document is from Microsoft MSDN website
Normally "API communication error" means the application cannot talk to the Integrity server, there are two scenarios:
1. The PC running your application IS the Integrity server, then CreateLocalIntegrationPoint should be used
2. The Integrity server is somewhere else, then CreateIntegrationPoint should be used to give an IP address
Hope that helps.