P4 Lightweight Plugin for Visual Studio
A lightweight Visual Studio extension for Perforce integration. Works alongside the built-in source control system without replacing it.
Features
- Auto-detect P4 workspace via
.p4config, environment variables, or JSON configuration
- Prompt for checkout when editing read-only files, with changelist selection dialog
- Smart changelist management - create, select, reuse, and delete changelists
- Multi-workspace support - automatic workspace resolution per file path (Single/Auto/Nested modes)
- P4V integration - Browse, History, Timelapse, Diff, Submit, Resolve, and Pending Changelists
- File status display - revision, changelist, and out-of-date info shown directly in menus
- Allwrite workspace support - silent or prompted auto-checkout
- Fully configurable JSON menus - add, remove, reorder, or customize any menu item
- Dynamic placeholders -
${FileStatusLabel}, ${FileStaleInfo}, ${DepotPath}, and more
- Proxy and fallback connections - proxy-first detection with multi-server fallback
- Auto-reload on save - edit config in VS, save, and changes apply immediately
| Location |
Description |
| Extensions > P4 |
Main menu with all P4/P4V commands |
| Tab right-click |
Quick access on document tabs |
| Solution Explorer file |
Right-click on files |
| Solution Explorer folder |
Right-click on folders (reconcile, sync, scripts) |
Context menus can be displayed flat (default) or grouped under a "P4" submenu via the ContextMenuStyle setting.
Built-in Commands
| Command |
Description |
| P4: Checkout |
Open file for edit (with changelist selection) |
| P4: Revert |
Revert opened file or restore modified file |
| P4: Sync Newest |
Sync to latest server revision (shown when out of date) |
| P4: Mark for Add |
Add untracked file to depot |
| P4: Resolve |
Auto-resolve file conflicts |
| P4: Reconcile |
Detect and reconcile file status |
| P4V: Browse |
Open file in P4V workspace window |
| P4V: History |
Show file revision history |
| P4V: Timelapse (Blame) |
Annotated time-lapse view |
| P4V: Diff |
Compare local changes with depot |
| P4V: Diff Previous |
Diff against previous depot revision |
| P4V: Diff Newest |
Diff local vs latest depot revision |
| P4V: Submit |
Open P4V submit dialog |
| P4V: Pending Changelists |
View pending changelists |
| P4V: Sync Workspace |
Sync entire workspace |
| CFG: Edit Config |
Open JSON config (auto-reloads on save) |
| CFG: Clear Cache |
Clear all P4 status caches |
| CFG: Reload Config |
Manually reload configuration |
Dynamic Placeholders
Menu display names and command arguments support placeholders:
| Placeholder |
Description |
Example |
${FilePath} |
Local file path |
D:\Project\file.cpp |
${DepotPath} |
Depot path (async, cached) |
//depot/main/file.cpp |
${FileStatusLabel} |
Status with icon |
edit CL:12345 |
${FileStaleInfo} |
Out-of-date info |
(#3:#5 @CL:67890) |
${FileHaveRev} |
Local revision number |
3 |
${FileHeadRev} |
Server head revision |
5 |
${FileHaveCL} |
CL of local revision |
54321 |
${FileHeadCL} |
CL of head revision |
67890 |
${ChangelistId} |
Selected changelist ID |
12345 |
${FolderPath} |
Parent folder path |
D:\Project\ |
${WorkspaceRoot} |
Workspace root directory |
D:\Project |
Configuration
Configuration is stored in %LOCALAPPDATA%\P4Plugin\MenuConfiguration.user.json.
Open via Extensions > P4 > CFG: Edit Config. Changes auto-reload on save.
Menu items are upgraded automatically when the plugin updates. User settings (connections, logging, behavior) are preserved across upgrades.
Key Settings
| Setting |
Values |
Description |
WorkspaceMode |
Single / Auto / Nested |
Workspace resolution strategy (default: Auto) |
ContextMenuStyle |
Flat / Submenu |
Context menu display style (default: Flat) |
AllWriteAutoEdit |
Silent / Prompt / Disabled |
Allwrite workspace behavior (default: Silent) |
ForceEnable |
true / false |
Skip workspace detection (default: false) |
Connection Priority
.p4config file in project directory
- P4 environment variables (
P4PORT, P4USER, P4CLIENT)
- JSON
DefaultP4Connection configuration
P4PLUGIN_DEFAULT_P4PORT / P4PLUGIN_DEFAULT_PROXYPORT environment variables
P4PLUGIN_FALLBACK_P4PORT / P4PLUGIN_FALLBACK_USER environment variables
Proxy Support
Configure proxy servers via P4ProxyPorts in JSON or P4PLUGIN_DEFAULT_PROXYPORT environment variable. Proxy connections are tried first for lower latency.
Requirements
- Visual Studio 2022 (17.0+) - Community, Professional, or Enterprise
- Perforce command-line client (
p4.exe) installed and accessible via PATH
- P4V (optional, required for visual diff/history/browse/submit features)
License
See LICENSE.txt included in the extension.
| |