views:

222

answers:

3

For our code review process we open the details of a shelveset to see all files that have been worked on. Right clicking and choosing "Compare" works great for existing ( modified ) files. But, when a file has been added I just want to view the file. 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.

Does anyone know how to get this prompt to show up for .cs files ( and all other files, for that matter )

Thanks!

Configuration: Visual Studio 2008 SP1 Visual Studio 2008 Team Explorer .net 3.5 SP1 Team Foundation Server 2005

+3  A: 

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.

AakashM
Interestingly, when I open a .cs file from Windows Explorer, it correctly opens with VS2008. I deleted the file as you directed, anyway, to see if I would get the prompt(s).In summary, it worked. But it doesn't make sense to me why Windows Explorer knew to use VS2008 and TFS did not. Oh well.Thanks!
Josh Leonard
A: 

Inspired by AakashM's reply, and since I am using Notepad2 recommended by @shanselman here: http://goo.gl/9njZ 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: a) 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. Or even better b) 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.

Proto
A: 

So I am answering with a comment b/c the stackoverflow idiots think I shouldn't be able to comment. The default action in windows is to open with VS and it still opens with notepad. Whatever the explanation, this is yet another reason why TFS is the wrong tool for the job. Furthermore, the default behavior on most of these "screens" should be to diff, not open.

Wes