Compare files on double click in Pending Changes v

2019-01-13 03:04发布

Is there a way in visual studio to change the behavior when I double click a file in the 'Pending Changes' view.

The default behavior is, that Visual Studio opens the file in code editor, but I want that it opens the 'Compare'-Dialog with the latest version. (same behavior as in TortoiseSVN)

6条回答
Summer. ? 凉城
2楼-- · 2019-01-13 03:42

The steps for VS2017 are a bit different. VS 2017 uses its own private registry, which is stored in your AppData folder.

Steps

  1. Close all visual studio instances

  2. Select the HKEY_USERS node, and click File > Load Hive

  3. Open privateregistry.bin which can be found at %UserProfile%\AppData\Local\Microsoft\VisualStudio\15.0_[*some key*]

  4. Provide a key name. Eg VS2017PrivateRegistry

  5. Navigate to the following path and create a new DWORD with value of 1.

    Path:HKEY_USERS\VS2017PrivateRegistry\Software\Microsoft\VisualStudio\15.0_[*some key*]\TeamFoundation\SourceControl\Behavior

    Value: DoubleClickOnChange (DWORD) 1

  6. Select HKEY_USERS\VS2017PrivateRegistry

  7. Click File > Unload Hive

查看更多
放荡不羁爱自由
3楼-- · 2019-01-13 03:43

Put this on a .reg file and and double click it, this will make your double click compare instead of opening the file in the pending changes window.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\SourceControl\Behavior]
"DoubleClickOnChange"=dword:00000001

Make sure the Visual Studio version is correct.

查看更多
疯言疯语
4楼-- · 2019-01-13 03:44

Do shift + double-click instead.

查看更多
【Aperson】
5楼-- · 2019-01-13 03:46

There is a way to make this permanent so you don't need to shift + double-click: http://www.richard-banks.org/2010/07/how-to-double-click-to-diff-pending.html

Path: HKCU\Software\Microsoft\VisualStudio\<ver>\TeamFoundation\SourceControl\Behavior
Value: DoubleClickOnChange (DWORD)

0 == view as the primary command (default)
1 == compare as primary command

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-01-13 03:46

You could also apply some Visual Studio keyboard short cuts for the various comparison types - Latest, WorkSpace and Previous.

See the following post: Comparison keyboard shortcuts for Pending Changes in TFS

查看更多
混吃等死
7楼-- · 2019-01-13 03:56

VS 2017 or newer

This PowerShell script should turn this on for the latest installed instance (adapted from Anish's answer)

You'll need to close all VS instances first.

$instanceId = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property instanceId).Trim()
reg.exe load HKLM\VS2017PrivateRegistry $env:LOCALAPPDATA\Microsoft\VisualStudio\15.0_$instanceId\privateregistry.bin
reg.exe add HKLM\VS2017PrivateRegistry\Software\Microsoft\VisualStudio\15.0_$instanceId\TeamFoundation\SourceControl\Behavior /v DoubleClickOnChange /t REG_DWORD /d 1 /f
reg.exe unload HKLM\VS2017PrivateRegistry

VS 2015 or older

This PowerShell command should turn this on for all installed versions:

Set-ItemProperty HKCU:\Software\Microsoft\VisualStudio\*\TeamFoundation\SourceControl\Behavior DoubleClickOnChange 1
查看更多
登录 后发表回答