This project is read-only.
Note: See Release Notes at the bottom of this page.
  • This package can be installed from Visual Studio Gallery using Tools + Extension Manager.
  • This package is open-source and is hosted on Codeplex.
  • The Perforce connection settings (Server, UserName, etc.) are set in Tools Options Source Control + VS2P4 and are persisted by Visual Studio between sessions.
    • You can enter one set of connection information, or you can tell VS2P4 to rely on P4CONFIG, allowing you to move between connection configurations.
  • No information is persisted to the project files or the solution (.sln) file.
    • All projects are always assumed to be under source control. If a file is not recognized by Perforce, a blank icon will appear.
    • If your project is marked to use another source control plugin (e.g. P4SCC)
    • and if you have that source control plugin installed,
    • VS will automatically change to that source control program.
    • You'll have to manually change the source control to VS2P4 each time.
    • Preferably uninstall the plugin (e.g. P4SCC), or even remove their source control from the solution and projects.
  • An added file is Marked for Add into Perforce. AutoAdd is optional.
  • A deleted file is Marked for Delete in Perforce. AutoDelete is optional.
  • File rename is carried out in Perforce (integration is done, history is preserved).
  • But you can't revert a renamed file from within Visual Studio.
  • All commands can be done on an entire project (or even the entire solution) at a time.
  • There is an option whether or not to prompt before reverting files (and possibly losing changes).
  • Icons conform to P4V icons as closely as possible. See FileState.cs for details.
    • You can visually see files that need to be resolved or files that are not at the head revision.
  • Logging at various levels (e.g. Error or Information) goes to the Output Window under VS2P4.
    • Starting VS (devenv.exe) with /log will cause logging to go also to ActivityLog.xml, e.g. %AppData%\Microsoft\VisualStudio\10.0\ActivityLog.XML, depending on the Logging level set in the Options window. Open ActivityLog.XML in Internet Explorer to see a more readable version of the log.
    • Note that Logging at Information level causes significant slowness.
  • Most of the work getting file states (glyphs) from Perforce is done on a background thread.


 1. I'm having trouble connecting, or files aren't showing as "under Perforce" when they should be.

  • Run "p4 info" from a cmd or PowerShell window at the location of your sln file. "Server address" corresponds to "Server" and "Client Name" corresponds to "Workspace" on the VS2P4 Connection dialog (under Tools + Options + Source Control). 
  • The Submit command is not supported (i.e., you can check out but you can't check in).
    • The intent is to use P4 or P4V to manage changelist and do submission.
  • Some commands (Reports) currently use P4.EXE.
  • A file that is Added or Renamed must be checked in (submitted) and checked out again (opened for edit) before it can be Renamed again.
1. Edit (Check out)
2. Mark For Add (adds a file not in Perforce to Perforce)
3. Revert If Unchanged
4. Revert
5. Get Latest Revision
6. Revision Graph
7. Diff Against Have Revision (Set environment variable $P4DIFF to change the Diff program.)
 You may need to do this command: p4 set P4DIFF=P4MERGE
8. Time-lapse View
9. Refresh All Glyphs

Note that each command 1 through 8 can be disabled on the Options page.
Note that VS limits us to their 12 standard icons plus only 4 custom icons. :(
  •  NotSet -- Solid Red circle with white dash (shown until Perforce state is retrieved on background thread)
  • NotInPerforce --Blank (No glyph)
  • CheckedInHeadRevision -- Page with green dot in lower right corner
  • CheckedInPreviousRevision -- Yellow triangle
  • OpenForEdit (checked out) --Red check mark
  • OpenForEditOtherUser -- Page with green dot in lower right corner (same as CheckedInHeadRevision)
  • OpenForEditDiffers --Yellow triangle (save as CheckedInPreviousRevision)
  • OpenForAdd  -- Red plus (result of a VS Add or a VS2P4 Add)
  • OpenForRenameSource  -- Red circle with diagonal (Shouldn't see this in VS)
  • OpenForRenameTarget -- Red plus (result of a VS Rename)
  • Locked -- Padlock black outline
  • LockedByOtherUser -- Page with green dot in lower right corner  (same as CheckedInHeadRevision)
  • OpenForDelete --  Red circle with diagonal (Shouldn't see this in VS)
  • OpenForDeleteOtherUser -- Red circle with diagonal (Shouldn't see this in VS)
  • DeletedAtHeadRevision -- Red circle with diagonal (Shouldn't see this in VS)
Release Notes:
  • Significant Changes in 1.1:
    • Fixed tab order in options control.
  • Significant Changes in 1.2:
    • Fixed problem where VS2P4 was unnecessarily checking out project files after opening a solution
    • Added "Use P4Config instead" checkbox to Options
      • Checking it causes connections to be based on the environment (e.g. P4Config) instead of explicit settings. 
      •  This allows you to connect to different Perforce servers and workspaces without changing VS2P4 Options. 
      •  Note that the connection is based on the location of the solution file.  
      •  e.g. environment variable P4CONFIG might be set to p4.cfg. The p4.cfg file at the root of a workspace might contain: 
        •  P4PORT=perforce:1666 
        •  P4USER=Dale.Brubaker
    • Supported SUBST drives.
    • Made Perforce file state updates much faster, especially for large solutions.
  • Significant Changes in 1.3
    • Fixed problems making VS2P4 active after a solution was already loaded.
  • Significant Changes in 1.31
    • Fixed Issue Id #196: Tools + VS2P4 Options confirmation dialog was asking for confirmation even when no changes were made.
  • Significant Changes in 1.32
    • Always prompt user for approval before making a file writable at Save.
  • Significant Changes in 1.33
    • Fix problem where Exclude From Project was marking for delete in Perforce.
    • Lighter-weight and more-green checked-out icon.
  • Significant Changes in 1.34
    • When a file is not in the Perforce workspace, show the NotSet icon only for that file, and show correct icons for the other files.
  • Significant Changes in 1.35
    • When a file is not in the Perforce workspace, simply treat it as a file not controlled by Perforce.
      • This fixes a problem where VS2P4 disallowed Rename on uncontrolled files.
  • Significant Changes in 1.36
    • Auto-refresh all glyphs when a project is added or reloaded.
  • Significant Changes in 1.37 (by Bill Leonard)
    • Fix problems where Perforce was sometimes returning forward slashes instead of backslashes, causing VS2P4 to report the file not in Perforce.
    • Change File Rename to allow spaces in the pathname.
    • Persist the "Use P4Config" option setting.
  • Significant Changes in 1.38 (by Dale Brubaker)
    • Fix potential crashing when starting without a Perforce connection.
  • Significant Changes in 1.50 (by Bill Leonard)
    • Separated the options dialog into two separate dialogs.
  • Significant Changes in 1.51 11/9/11 (by Dale Brubaker)
    • Fixed crashing bug (in Microsoft's sample code) involving service references and perhaps other "special" solution nodes.
    • Improved speed of updating file states when a solution includes at least one file not under the Perforce Root.
  • Significant Changes in 1.52 11/11/11 (by Dale Brubaker)
    • Changes in 1.52 (by Dale Brubaker)
    • Added better thread safety and fixed duplicate file name exceptions in version 1.51 changes.
    • Added timestamp to log messages.
  • Significant Changes in 1.53 11/16/11 (by Dale Brubaker)
    • Allow the P4 workspace to be a virtual (SUBST) drive.
      • A filename on a virtual drive is converted to the non-virtual real path for matching to Perforce, as before.
      • But if the Perforce root is a virtual drive, the client files must also be loaded from the virtual drive.
    • Improve robustness for connection issues.
    • Handle and log exceptions on the background thread while setting file states.
  • Significant Changes in 1.54 (by Dale Brubaker)
    • Fix a trailing slash issue that sometimes caused a file not to appear to be under the Perforce Root
  • Significant Changes in 1.55 11/25/11 (by Dale Brubaker)
    • Fix failure of Log Level option to persist.
  • Significant Changes in 1.60 12/2/11 (by Dale Brubaker)
    • Fixed problem where child files (e.g. the Form1.designer.cs file under Form1.cs) were not being handled when the parent was selected.
  • Significant Changes in 1.70 2/3/12
    • Changed P4.Net files (p4dn and p4api DLLs) to support Perforce 2011.1 stream depot files (2011.1 is the first version which supports streams).
    • Accommodate cases where the Perforce root has forward slashes instead of backward slashes.
    • Fixed the Move command to do a P4.Net move instead of running P4.EXE. This means that reverting either the add or the delete reverts them both.
  • Significant Changes in 1.71 2/4/12
    • Recompiled P4.Net files with VS2010 compilers instead of VS2005 compilers (VC10 instead of VC8), because of crashing error due to side-by-side errors.
  • Significant Changes in 1.72 2/7/12
    • Don't allow deletion of a checked-out file (opened for edit).
    • Developer changes for unit testing -- use environment variables instead of Settings.
  • Significant Changes in 1.73 3/2/12
    • Support Visual Studio 11 Beta
  • Significant Changes in1.74 3/15/12
    •  Very significant performance improvements, especially for solutions with thousands of files.
  • Significant Changes in1.75 3/31/12
    • Allow rename of a file Marked for Add as well as a file Checked Out
    • Allow rename of a folder
    • Made QueryStatus() a bit faster (right clicking on Solution or any other node).
      • But it's still slower than when VS2P4 is not enabled, as we must check the file states to see what Context Menu items should be enabled.
    • Merged in Bill Leonard's dev branch. Bill did the following:
      • Fixed several timing problems and race conditions with P4Cache. Implemented a wait mechanism for waiting for the cache to update for tests.
      • Implemented an XML-based mechanism for getting default settings for the Perforce connection information. This allows unit tests to have different settings
        • depending on what is being tested. Also allows the user to set some defaults for Visual Studio connections based on the solution name, or general defaults.
  • Significant Changes in 1.76
    • Fixed an ArgumentNullException in Map.IsFileUnderRoot() that could occur when nothing in the solution is under source control.
  • Significant Changes in 1.77 4/18/2012
    • On Connection Options dialog, enable the Test button even when "Use P4Config instead" is checked.
    • Much faster start-up for opening a new solution (in many cases was checking Perforce one file at a time).
    • Fixed bug -- we weren't persisting Connection settings between sessions.
  • Significant Changes in 1.784/20/12
    • Added an option on the Command Options dialog to "Ignore Files Not Under Perforce Root". 
      • Checking this box will make solutions refresh faster when they have lots of files not under the Perforce root.
      • But "non-standard" workspace mappings could cause VS2P4 to show files "not under Perforce control" that actually were under Perforce control.
      • The default (not checked) is to rely on Perforce to determine which files are under Perforce control.
  • Significant Changes in 1.794/21/12
    • Corrected "Ignore Files Not Under Perforce Root" to default to not-checked.
  • Significant Changes in 1.806/5/12
    • Fixed failure to persist global options for connection options.
    • Changed global option names to avoid conflicts with other packages.
  • Significant Changes in 1.816/23/12
    • Speed improvement where UI might seem to hang for a bit. As a result, the context menu for a file won't show P4 options until Perforce file states have been updated.
    • Allow editing of files opened for branching or integration. Thanks to Anthony Brien for this fix.
  • Significant Changes in 1.82 6/29/12
    • Fixed bug where only the last file of a deleted pair of parent/subsidiary files was marked for delete in Perforce. For example, deleting a WinForm Form1.cs would physically delete both Form1.cs and Form1.designer.cs, but Perforces wasn't "told" about Form1.cs
  • Significant Changes in 1.83 8/19/12
    • Allow Mark for Add of files that are Marked for Delete.
    • Fixed problem where File Open Web Site tried to add files before VS2P4 was ready to connect to Perforce.
      • But note that File Open Web Site creates a solution in the default location which may not be under the Perforce root you expect! 
      • You'll need to save the solution under the root, and close and re-open it, before proper connections to Perforce can be made.
  • Significant Changes in 1.84 9/3/12
    • Fixed bug where files deleted from C++ projects weren't being deleted from Perforce.
  • Significant Changes in 1.85 3/15/13
    • Do not close the connection when loading files.
      • This hurts the proxy in remote sites, and therefore causes the solution to load slower. [Thanks to vosherman.]
    • After editing a file and then an external client (e.g. P4V) changes the file state,
      • allow VS2P4 to checkout and edit the file again instead of complaining about it's being read-only. [Thanks to jbdube.]
    • Fixed problem where VS 2012 simply wouldn't work with VS2P4 -- all files showed red icons and buttons were disabled. [Thanks to oroussea.]
  • Significant Changes in 1.86 3/29/13 [Thanks to jspelletier]
    • Removed writable file popup occurring when trying to save a file that VS2P4 thinks is in checkout but is not.
    • Removed writable file popup occurring after reverting a file that is not up to date(2 cases)
    • VS2012: Fix refresh when the solution format is VS2012 when loading a solution:
      • With VS2010 sln format: all the projects are already loaded when the OnAfterOpenSolution() is called and OnAfterLoadProject() is not called.
        • Thus the full refresh of the solution works.
      • With VS2012 sln format: When OnAfterOpenSolution() is called the projects are not loaded yet and OnAfterLoadProject will get called after each project
      • Previously, when refreshing, VS2P4 was always refreshing the status of the whole solution.
        • This means that with a solution of 50 projects it was refreshing the solution 50 times instead of refreshing the individual project that gets loaded. This was taking forever and blocking the UI almost always during the refresh.
      • Note: When working in VS2012 with the VS2010 file formats files stays in VS2010 format until you run the performance wizard.
        • When this occurs VS silently creates a performance project and convert your solution to VS2012 format which triggered that problem.
  • Significant Changes in 1.87 10/14/13
    • 1.86 was too aggressive in minimizing refreshes and sometimes a "collapsed" project would not be considered.
    • Now we always refresh everything when we open a new solution.
    • Hopefully we now support VS2013. No promises. Tested with VS 2013 RC, and it seems to work.
  •  Significant Changes in 1.90 7/24/15
    • Now supports Visual Studio 2015. Not extensively tested, and essentially not supported.
    • This product is essentially end-of-life as far as the author is concerned. But you have the source code if you want to debug it for yourself. Or maybe (hopefully) someone will take it over.

Last edited Jul 24, 2015 at 2:21 PM by dalebrubaker, version 60


No comments yet.