Installing P4 API for .NET
This section details the release compatibility and installation for P4 API for .NET.
Installation
The simplest way to install P4 API for .NET is using the NuGet package manager. Alternatively libraries can be added manually from the archive - see Earlier Versions in the Perforce Portal.
Once downloaded, follow these steps:
-
Open Visual Studio.
-
Click File > New File.
-
Select .Net: New Project.
-
From the templates, select Console App.
-
Give a name to your project, for example P4Test.
-
Click Create.
-
In Visual Studio, on the left side, click Explorer (or Ctrl+ Shift + E)
-
Open Solution Explorer and right-click on your project.
-
Click on Add NuGet Packages.
-
In the Browse bar in the top middle of the page, search for
p4api.net. -
Select the latest version of P4 API for .NET and click Install.
To verify the package is installed, in Visual Studio, in your project, look in Dependencies > Packages and you should see P4API.Net.
Install P4 API for Python from source
Download P4 API for .NET from one of the following locations:
Alternatively, libraries can be added manually from the archive:
- Following assemblies must be in the build output directory:
For Windows:
p4api.net.dll and p4bridge.dll
For Linux:
p4api.net.dll and libp4bridge.so
For macOS:
p4api.net.dll and libp4bridge.dylib
- On creation of a new console application, the Debug output location would be:
For Microsoft .NET framework:
...\SolutionDir\ProjectDir\bin\Debug\.
For Microsoft .NET Core:
...\SolutionDir\ProjectDir\bin\Debug\net6.0\
- Add the p4api.net.dll as a project reference by clicking Add Reference... on the References node of the project in the solution explorer in Visual Studio and browsing to the location of the newly added p4api.net.dll.
Release compatibility
P4 API for .NET is subject to change from release to release, and is not guaranteed to be source-code compatible from one release to the next. However, clients that you create using P4 API for .NET can run against previous releases of the P4 Server and will probably run against later releases of the P4 Server.
Support for specific features depends on the version of P4 Server and P4 API for .NET that you use.