views:

399

answers:

3

In Visual Studio with TFS as source control, when I view the history and double click a cs file, the file is loaded in notepad. How can i change the application to be notepad++?

I also would like the OS's default application for the file to still be visual studio

+1  A: 

I don't see any options in Visual Studio for changing that, so I'm guessing it uses the system's default text editor.

Try assigning Notepad++ as the default handler for *.cs files.

You can do this from withing Notepad++ by going to Settings/Preference/File Association.

You can also do it by right-clicking on a .cs file in explorer, go to Open With/Choose Program..., then select Notepad++ and check the "Always use the selected program to open this kind of file" box before hitting OK.

Herms
I can change the default application to notepad++ (the changeset viewer even shows the n++ logo for .cs files), but .cs files still open in notepad. Any other ideas?
Ryan
Don't know of anything else to do. I've run into similar problems. Double-clicking on .java files causes Word (of all things) to open. Which is extra strange.
Herms
Could you guys try my solution and let me know if it works?
Aardvark
A: 

The only way I found is to replace notepad with notepad++. This article describes how to do it. Don't forget to check the comments to get a link to the "little exe" that comes with notepad++. Works like a charm on W7 x64.

Cheers, Phil

Phil
A: 

After pouring over ProcessMonitor logs I think I found the solution!

You need to change the what the Windows shell (explorer) thinks the "Edit" action for text files. I was able to change this key:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\SystemFileAssociations\text\shell\edit\command

to something other than Notepad (in my case notepad2). Now Visual Studio's TFS's changeset dialog opens cs files with that editor.

This will probably change the edit option for not just cs files, but everything considered "text'. The registry entries for file associations are pretty complicated. I suspect that it would be possible to disassociate .cs files from this common "text" category and make this change only for cs files (but I'm not that ambitious). Also, I wouldn't be surprised if people's file associations / shell commands (open, edit, etc...) vary from machine to machine (OS versions, tools installed, etc) - so YMMV.

Aardvark