Visual Studio files association in Windows

只愿长相守 提交于 2019-12-23 09:33:12

问题


In Windows Explorer when I double-click on any Visual Studio file (*.cs, *.csproj, etc.), it's opening an old version of VS instead of the latest one (VS 2017). And VS has associations with too many file types.

How can I change the default Visual Studio (for all those files that VS can handle)?

There is a similar old question about Visual Studio 2008 (Move file associations from Visual Studio 2005 to 2008) but the solution in there doesn't work anymore (there is no "Restore File Associations" button on the settings of Visual Studio 2017).


回答1:


Each version of Visual Studio registers itself in the Set Default Programs panel of the Control Panel. Go to Control Panel\Programs\Default Programs

Then choose Set Default Programs:

In there you can simply choose the Visual studio version of your choice and then click the button Set this program as default in order to associate every file type that VS handles.

Or you might prefer to click the button Choose defaults for this program to review the current associations of those file types and change only the ones you want.




回答2:


Yet another in a long list of previously working-just-fine things which Microsoft have managed totally #$@%@ up. If I try to change defaults the 'right' way I get this kind of thing:

i.e. completely ignored. The only way I've managed to solve it is by removing the file association entirely through the registry. Let's take .asm as an example:

  1. Open Registry Editor / "regedit.exe"
  2. Navigate to HKEY_CLASSES_ROOT\.asm\OpenWithProgIds
  3. Delete any Visual Studio values you see

From there, you can (finally) open files with whatever you choose instead of having the association clamped to Visual Studio:

For the record, I believe this to be a problem with Windows 10. Not with Visual Studio. See: https://answers.microsoft.com/en-us/windows/forum/windows_10-files/cant-change-default-programs-in-windows-10/229fc3a9-25c9-433b-a333-5806bc5090db




回答3:


On the file you will always open with vs17, click right and choose open with and there choose another app. On win10 it pop out a dialog with some proposals. If vs17 is there, choose your favorite and activate the always open with. then ok and your done.



来源:https://stackoverflow.com/questions/46351778/visual-studio-files-association-in-windows

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