September 9, 2011

P4API.NET: Perforce for the .NET platform


The .NET environment is the defacto standard development platform for Microsoft Windows, so I'm happy to see the new Perforce API for .NET, P4API.NET, go into beta release. This new API will make it easy to develop tools and integrations in the .NET world. Compared to coding around the Perforce command line client, using the API will make a program easier to read, more efficient, and more robust.

Like all of Perforce's APIs, P4API.NET will let you control the connection to the Perforce server. You can run a bunch of commands through a single connection, perfect for build automation. And P4API.NET more gracefully handles all those weird edge cases that tend to make scripts break. (Ever been bitten by a file name with spaces in it?)

There are two sample applications included with P4API.NET to get you started. One is a console (command line) application, and the other has a GUI. Both sample apps demonstrate basic features like connecting to a Perforce server and retrieving data. You can build and use both of them easily using the included Visual Studio solution file. Note that you may have to set your target platform to x86 if you're building on 64-bit Windows.

The new P4API.NET beta release rounds out Perforce's suite of APIs, joining the existing C++, Java, Perl, Python, Ruby, PHP, and JavaScript APIs. No matter what language you like to use for your scripts and tools, you'll probably find a Perforce API that meets your needs. Give P4API.NET a spin, let us know what you think, and keep an eye out for more Perforce tools built on this platform.