Visual Studio is the tool that most games programmers come to use for their day to day work. Perforce also seems to spread amongst games companies as the SCM system of choice. On paper Visual Studio also have source control integration. Great, now everything just happens automagically! No need to think about those mundane issues, I can just concentrate on the code. Well, that's wrong. You do need to concentrate on the "mundane" issues. One of the things that annoys me to no end is the fact that when you have the SCM feature enabled the time it takes to open a solution. Historically Visual Studio and SCM plugins have played poorly together, maybe because the source control integration in Visual Studio was modeled around Source Safe (and the unfortunate amongst us that have used that can follow the extrapolation... to horrible cursing and hair pulling). This article introduces a plugin to Visual Studio that tries to a little less, including less bugs :) and less time consumed. Ambitious...


The plugin will install a couple of context menus, one for the project items, one for the projects and one for the solution. All of them basically just edits the item selected. Additionally there is a command called "NiftyPerforce.P4Edit" that just edits the currently active document. This should not be needed, but is included as a backup to the autocheckout feature that before each keystroke in a document checks if it's readonly and if so, checks it out of perforce.

Context menu in action
Fig 1: The context menu item giving you the option to open the underlying item for edit in perforce.

The plugin will assume that the command "p4.exe" is somewhere in the path as it's not a very intelligent plugin. It's simply a glue between the p4 command line and the IDE. The plugin is pretty verbose, most of the commands and their output is piped to the outputpane.

Output from the plugin.
Fig 2: Sample output from a session with NiftyPerforce.

In closing

Code for this plugin was inspired by code from Noel Llopis, Charles Nicholson and Dave Etherton. This plugin was mainly put together as a proof that it can be done. Now, I'm no C# jock, so beware of atrocities in the code if you dare to open it up. The installer should be used for the brave that just want it to work right now (TM). Ok, that's it for today I guess. Happy hacking!


2006-09-28: Uploaded the code to google code.
2006-09-25: Added a configuration option. You can now invoke the following dialog through the Tool->NiftyPerforceConfig.

Config dialog.
Fig 3: The configuration option.