views:

328

answers:

3

So I'm happily working on a project making heavy use of custom .xml configuration files this morning.

All of a sudden, whenever I double-click an .xml file in Solution Explorer, it opens in Notepad instead of within Visual Studio.

Thinking that it was the Windows file associations, I right-clicked on a file in Explorer, selected Open With >> Choose Defaults, and selected Visual Studio 2008.

But the problem remains -- now when I open a file from Explorer, Visual Studio Opens, then it opens Notepad.

Needless to say, this is very frustrating, and Google is not much help. Has anyone else ever had this problem, and what did you do about it?

Notes:

  • This only happens for .xml files. Other text files (.config, .txt) open within Visual Studio just fine.
  • This has nothing to do with Windows file associations, as Windows open up VS2008 just as it should. This is some crazy problem internal to Visual Studio.
  • I've also tried Tools >> Options >> General >> Restore File Associations. No luck.
  • Nothing present in Tools >> Options >> Text Editor >> File Extension
  • This is what my "Open With" menu looks like for .xml files. As you can see, "XML Editor" is set to the default. alt text
A: 

If you go into Tools > Options > Text Editor > File Extension, do you have anything in here that is mapped to notepad? If so remove that and it should clear it up. Also, if you have an XML file in a project, you can right click on it, choose Open With and choose your default editor there.

Update: see comments for other things to try

Shawn Steward
The default editor is currently set to "XML Editor". However, when I click okay, the file still opens in Notepad.
Portman
Does running %InstallPath%\devenv.exe /resetskippkgs help?
Shawn Steward
It did not. But then I just uninstalled and reinstalled, which wasn't really THAT much of a PITA, and it did correct itself. Weird. I'm upvoting and accepting for all the effort.
Portman
I don't want to uninstall and reinstall, but I still have the same problem. I first noticed because I was dragging xml files from explorer into VS. I'm trying /resetskippkgs (hope it doesn't kill coderush) but since it didn't help before, what else should I try.Note: I started VS as the Administrator user as well (not just UAC, but different windows account) and the same behavior happened, so it must be a system level VS settings and not something in my vssettings.
jrwren
I found my problem:Apparently the XML files which i was opening were all UTF-16 encoded. Visual Studio was opening UTF-8 encoded XML files just fine.I'm not sure why VS can't open UTF-16 files, but I guess I'm OK with using vim.
jrwren
A: 

I had similar problem with .txt files. I tried to open that file from VS using "Open with..." and VS opened it, but showed garbage for every second character. The problem went away when I saved the file to a different codepage. Though it is still a bit strange, since a copy of that original file in original codepage did open in VS with double-click correctly and and showed also correctly.

levitation
A: 

I think "showing garbage for every second character" is due to that file being saved as unicode, but treated as non unicode in the editor

Anuruddha