From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

LabVIEW Perforce API based upon Perforce .NET API

Code and Documents

Attachment

UPDATE [10/19/2015]: I have re-uploaded the .zip file containing the API. The first time I uploaded it, I accidentally included a lot of the files from the official Perforce .NET API, including a lot of help files, which bloated the upload .zip. This apparently caused the virus checking to never complete, so hopefully this re-upload gets people the API. It is currently unchanged, but please feel free to comment with changes you have made or issues that come up. I am currently unable to update the API, but very soon I should be able to update it and integrate people's changes/additions if there are any. A few people have already contacted me regarding the API.

*******************************************************************************************************************

This is an API meant to interact with a Perforce server rather than the feature-poor SCC API that ships with LabVIEW or the P4 command line tool. It is built on top of the Perforce .NET API using LabVIEW's .NET integration, so you get an object-rich API rather than writing string parsers for the P4 command line tool.

The library is fairly modular and was built up over a period of months as more and more advanced scripting and API calls were needed. I would consider the robustness of the library to be equivalent to a well-built prototype, as most of the VIs work as expected in common use cases. There is a good foundation for myself or others to add to. Rather than build an API that replaces all of the Perforce .NET API, I took the approach of adding calls as needed, performing code re-factors as needed along the way to make the library well architected and modular.

General notes:

  • Add documentation. However, most VIs are self-explanatory via the name and inputs.
  • Add more thorough examples.
  • Add additional API calls as needed.

The first two points are where the official Perforce .NET API documentation is itself lacking.

*******************************************************************************************************************

LabVIEW version: 2013

This code is provided license free and is free for use, duplication, forking, etc. without restriction.

This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no even shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
stridle
Member
Member
on

Well since I'm unable to download the project as it's still int he virus scanning queue, I'll ask for some help.

I'm trying to load Perforce API .NET dll file through a LabVIEW .NET constructor, but am having no luck.

I'm using LabVIEW 32-bit on a 64-bit machine. Based on my research I should then use the 32-bit Perforce API. However, I tried both and see the same message An error occurred trying to load the assembly. Another search pointed to Win7 security limits, so I went to all the files properties and "unblocked" them. Still same error.

How did you load the p4api.net.dll file into LabVIEW?

bmitc
Member
Member
on

Hi there! Thanks for taking a look. There was a problem with the original upload, but I have just now re-uploaded the files. It is a much smaller upload after I deleted the unneeded Perforce help files (available on the Perforce site and not needed for using this API), so it should hopefully be available soon.

As to your question, I am not for sure what is wrong. What is the exact error? A screenshot might help.

Where are you installing the DLL? I included it next to my VIs along with my project and explicitly added it to my project. I can't remember if I had to unblock these DLLs in this particular instance, but I have had to do that before for other DLLs. I was using Windows 8.1 for reference, but this API has been used on Windows 7 machines. From there, you should be able to open up the .NET assembly browser in LabVIEW and manually browse to the assembly/DLL. Be sure that you have both the p4api.net.dll and the p4bridge.dll next to each other.

The API should hopefully be available soon, so don't bang your head over it too much. The official Perforce .NET API is rather poorly implemented, so it would be best to use this API as is or as a starting point. Someone else has contacted me regarding password support for connecting to a Perforce server. That is currently not implemented, but I gave them some pointers. I should be able to implement this change soon. I hope to eventually release these as packages for easier install scenarios.

MCKR_1009
Member
Member
on

Hi bimitchell, 

 

I have downloaded the above-zipped file. If I try to run a VI it is giving an error with message "specified .net class is not available". Do you have any idea regarding this? I am using LabVIEW 2016. Screenshot_1.png

 

Contributors