Visual Studio is one of the most popular IDEs in software development.
The Helix Plugin for Visual Studio –– called P4VS –– connects Visual Studio to Helix Core, version control from Perforce.
P4VS is available in the Microsoft Visual Studio Marketplace. You can download and install the plugin right from within Visual Studio.
Once it’s installed, you can perform all of the most important Helix Core version control functions from within the Visual Studio UI.
In this video we’ll install, configure, and get started using P4VS.
Once you have Visual Studio open, go to the extensions menu.
Choose Manage Extensions, click Online, then type “p4vs” into the search box. You’ll see the Visual Studio marketplace entry for P4VS – Helix Plugin for Visual Studio.
Close the displayed message and quit Visual Studio to finish installing.
As soon as Visual Studio closes, you’ll see the VSIX Installer verifying its digital signature.
Click Modify. P4VS will download and install into Visual Studio. Once completed, you’ll see a green checkbox next to P4VS.
Now that P4VS is installed, you can open Visual Studio.
To activate P4VS, go to the tools menu, and choose ‘options.’
To find P4VS, it is easiest to type ‘source’ into the search box.
Click on plug-in selection to confirm P4VS in the drop-down.
There are six additional Helix Core options, but right now we’re going to leave them set as default.
Just Click OK to exit the options menu.
To keep things simple, we’re going to open up an existing solution called NEWWEBAPP. It’s in a Helix Core Depot, and has a workspace on this computer. The project files are already synced from the server to the workspace.
In the file menu, open the connection to the Helix Core Server.
Enter ther connection information. For our needs, we are just going to leave the defaults for server, user, and workspace.
Next, go to the file menu and choose ‘open solution/project’ in Helix Core Server.
In the Depot dialog box, choose solution/project.
Once the depot is expanded, we an open the newwebapp folder.
Click newwebapp.csproj, then OK to open.
Since the project is in the Helix Core workspace, when it’s opened we can see Helix Core information in the Solution Explorer. This green dot indicates we have the latest revision.
Some files have blue question marks next to them. These files are not yet in the depot, but are on the workstation.
When you hover over a file, you can also see more information about the status of the file.
For more details, go to the view menu. Here you can open Helix Core views to display workspaces, file history, jobs, and more. These views are also accessible via the toolbar, and are resizable and dockable like other Visual Studio views.
For this example, we are going to make a quick change to SampleDataController.cs.
To check out the file, by simply right-click and choose ‘checkout’ in the solution explorer.
We can either select a pending changelist, or create a new one to hold the changes we’re going to make.
Now that the file is checked out, you can see a little red checkmark icon next to the file name. This lets you know that this file is indeed checked out.
To keep things simple, we’re just going to edit a comment in this file. Now let’s save these changes.
If you need to compare changes with a previous version, you can use the Diff Tool. Here we can see the differences between the files.
Now it’s time to submit this change back to the depot. Right-click on the file and choose ‘submit.’ Edit the changelist description to describe the work completed.
Notice that the file icon changed back to the green dot. This means the file is no longer checked out. And the version on the server is the same version on our workspace.
To view a file’s history you can use the P4VS File History Tab. For each revision of the file, we can see the revision, the changelist, the data submitted, who submitted, and a description of the changes.
Another great way to look at history is with CodeLens source control indicators. With CodeLens enabled, as you scroll through a source code file you can click on the “Perforce” indicator to see when a particular change in the code was committed to the server. You can see who made the change and the changelist number.
This is a just a quick tutorial of the plugin for Visual Studio. Download P4VS to try out all the features and get started.