简体   繁体   English

如何更改在Visual Studio 2010中查看TFS更改集时打开所选文件的默认程序(记事本)?

[英]How to change default program (notepad) which opens a selected file when viewing a TFS changeset in Visual Studio 2010?

I open the History in the Source Control, then open a changeset, then select a file in the file list and double click to open it. 我在源代码管理中打开历史记录,然后打开一个变更集,然后在文件列表中选择一个文件,然后双击打开它。 TFS open the file by Notepad, I wanna open the file by Visual Studio or by any other text editor (to have syntax highlight). TFS通过记事本打开文件,我想通过Visual Studio或任何其他文本编辑器打开文件(以使语法突出显示)。 How can I do this? 我怎样才能做到这一点?

PS. PS。 In my machine, when I open a .config file like app.config, TFS ask for a program to open it! 在我的机器上,当我打开像app.config这样的.config文件时,TFS要求程序打开它! I want TFS ask for the .cs file also! 我想TFS也要求.cs文件! There must be somewhere to set this I guess. 我想必须有一个地方设置这个。

I was able to configure this by adding new value to the registry. 我能够通过向注册表添加新值来配置它。

OS: Windows 7 Enterprise x64 操作系统:Windows 7 Enterprise x64

Steps on how to do it. 如何做到的步骤。

  1. Run: Regedit (alt + r, type regedit) 运行: Regedit (alt + r,输入regedit)
  2. Look for **HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\SystemFileAssociations** 寻找** HKEY_LOCAL_MACHINE \\ SOFTWARE \\ Classes \\ SystemFileAssociations **
  3. Right click "SystemFileAssociation" -> add new key then name it as .cs 右键单击“SystemFileAssociation” - >添加新密钥,然后将其命名为.cs
  4. Right click .cs and add new key then name it as shell 右键单击.cs并添加新密钥,然后将其命名为shell
  5. Right click shell and add new keys name it as edit and open 6 右键单击shell并添加新键,将其命名为edit打开 6
  6. Right click edit and add new key command then change the default value to point to the file exe you want it to run. 右键单击编辑并添加新的键命令,然后将默认值更改为指向要运行的文件exe。 ex: C:\\Program Files (x86)\\Notepad++\\notepad++.exe %1 例如: C:\\ Program Files(x86)\\ Notepad ++ \\ notepad ++。exe%1
    Don't forget to add the %1 at the end of the .exe 不要忘记在.exe末尾添加%1
  7. do the same for open 做同样的开放
    Just change the open and edit default value to the executable you want to run it with but don't forget to have the %1 as that will be the parameter given by tfs I assume. 只需将打开并编辑默认值更改为要运行它的可执行文件,但不要忘记使用%1,因为这将是我假设的tfs给出的参数。

    Hope it helps. 希望能帮助到你。

All files saved in TFS are saved in a path that starts with the following address: http ://YourServerNametfs01:8080/tfs/.../.../...&FileName=YourFileName.YourExt 保存在TFS中的所有文件都保存在以以下地址开头的路径中:http:// YourServerNametfs01:8080 / tfs /.../.../...& FileName = YourFileName.YourExt

This means that all files are opened using the default program defined for HTTP protocol, regardless of the extension for your file. 这意味着无论文件的扩展名如何,都使用为HTTP协议定义的默认程序打开所有文件。 You can probably change the default program for your HTTP protocol (if you have permissions, and usually you wouldn't) but this would also affect opening any regular web page or URL, which is probably not recommended. 您可以更改HTTP协议的默认程序(如果您有权限,通常也不会),但这也会影响打开任何常规网页或URL,这可能不建议使用。

I still haven't found a workaround this issue too. 我还没有找到解决这个问题的方法。

The only thing that works for me is when I set the default program for a file in Windows Explorer to open with the VS IDE: 唯一对我有用的是当我在Windows资源管理器中为文件设置默认程序以使用VS IDE打开时:

C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\devenv.exe C:\\ Program Files \\ Microsoft Visual Studio 9.0 \\ Common7 \\ IDE \\ devenv.exe

Might work similarly for 2010. 2010年可能会有类似的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM