TFS: How do I view .cs files in the VS IDE when viewing details of a shelveset?

五迷三道 提交于 2019-12-01 05:51:24

Double clicking ( or right click -> view ) opens .cs ( and .sql )files in notepad. When I try to open a .PRC file ( extension for our stored procedures ) I get a prompt that allows me to choose what program to use for viewing.

This isn't really a TFS issue, but more to do with how your local Windows is set up. If you navigate in Windows Explorer to a folder with .cs and .sql files in, and double-click them, you will be able to see that TFS is simply invoking the standard behaviour that is configured for these files.

To change it, again in Windows Explorer, go to Tools | Options, and on the File Types tab find the .cs file extension, and with it selected click Delete. Now attempting to open a .cs file will make Windows ask you what to do with it (note that if you check the 'Always use the selected program to open this kind of file' checkbox, you will be back where you started).

This is a global setting - I don't know if there's a way to make TFS do something different from just asking Windows to deal with the file. So if you want to keep the ability to launch notepad when double-clicking .cs files in Explorer, but still have TFS ask what to do with them, this won't help. Also, these instructions are pre-Vista - I don't know what's changed in Vista. You might want to ask on superuser.com what to do if you're on Vista and these instructions don't help.

Proto

Inspired by AakashM's reply, and since I am using Notepad2 recommended by @shanselman here, and since there is a way to permanently replace Notepad with Notepad2, as mentioned in the link provided in the same article (method 2 in that MSDN blog page), I first replaced Notepad with Notepad2 and then implemented AakashM's suggestion.

After that there are two options:

  1. You can set .cs files to be opened always in VisualStudio in which case the Changeset window -> Open prompted me to select an application to open cs files.
  2. Or even better, set .cs files to be always opened in Notepad2, and now that we have replaced Notepad with Notepad2, when we click Open from Changeset window it automatically opens in Notepad2 (with syntax highlighting).

Perhaps you can do it with any good text editor, but I haven't tried it with anything other than Notepad2.

your solution does not work for me. I checked windows explorer and my .cs files are actually associated with VS2008 (so when i double click a .cs file in windows explorer it will open in vs2008, which makes sense) but what is strange is I dont really use vs2008. I use VS2010 as code editor and regardless of the Windows Explorer file association my files are still opened in Notepad.exe (when i compare or view a shelveset and open a newly added file).

I think there must be a different association within visual studio 2010 or TFS somewhere ? (Im on Windows 7 if it makes any difference)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!