Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to associate files on Windows 10 #61084

Closed
garretwilson opened this issue Oct 16, 2018 · 13 comments
Closed

Unable to associate files on Windows 10 #61084

garretwilson opened this issue Oct 16, 2018 · 13 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) windows VS Code on Windows issues workbench-os-integration Native OS integration issues
Milestone

Comments

@garretwilson
Copy link

garretwilson commented Oct 16, 2018

I'm well aware how to associate an extension with an application on Windows. I can right-click in Explorer, select, "Open As...", select the application, and make sure "Always open with this app" is checked. Or I can go in to the properties of a file in Explorer, look at "Opens with", and click on "Change". Or I can go to "Choose default apps by file type …", etc. The problem is that none of this is working with VS Code.

I just installed VS Code 1.28.1 yesterday. Currently my .txt files are associated with EmEditor. I change the association to Notepad. No problem. I change the association back to EmEditor. That works.

But if I select the blue "Visual Studio Code" option that appears in the list of applications, nothing changes. The old association remains.

I even tried ignoring the blue icon in the selection list, and manually browsed and selected %LocalAppData%\Programs\Microsoft VS Code\Code.exe as the default editor. That doesn't work, either.

What's going on? Associating VS Code with my text files should be the most basic of basic Windows integration. Why won't it work?

@garretwilson
Copy link
Author

I've also asked this question on https://superuser.com/q/1367659/954883 .

@DragWx
Copy link
Contributor

DragWx commented Oct 18, 2018

I'm having the same issue, I have VS Code 1.28.2 installed on two computers running Windows 10, one is a user install (installed in %appdata%), the other is a system install (installed in program files). On neither computer am I able to choose VS Code as the default program to open, for example, .cpp files; regardless of whether I right click the file, "open with" or "choose another app", select VSCode and say "always use this to open this", or if I go through the settings app and try choosing VS Code as the default app for .cpp files, the end result is that the change does not apply, and whatever was set before stays there.

I was confused that there weren't more people reporting this issue, but a quick glance around the issue tracker suggests that other users have successfully been able to associate VS Code with file types in explorer, so I'm not sure what we're doing differently.

@garretwilson
Copy link
Author

One Super User answer hints that it may be because of VS Code's new installation location, in %LocalAppData%\Programs\Microsoft VS Code rather than C:\Program Files\…. Could that be related?

@garretwilson
Copy link
Author

I tried associating with %LocalAppData%\Programs\Microsoft VS Code\bin\code.cmd, but that just gave me an ugly terminal window in the background, and it still didn't associate *.txt with VS Code.

@DragWx
Copy link
Contributor

DragWx commented Oct 20, 2018

I'm doubtful that the installation location is the problem, because I have two PCs with VS Code installed; on one PC, it's installed in program files, and on the other, it's installed in appdata, and both PCs are unable to associate any files to VS Code.

You mentioned your install was recent; I originally installed 1.27.1 back in September (the "program files" install), and the other PC's install (the appdata install) was a few weeks later. I'm wondering if this is some recent installation-related bug, where the users who are able to associate files in Windows Explorer to open in VS Code did so with some older version of VS Code?

@mzhukovs
Copy link

I can't associate it with any file type. Running win10 1803 and latest user installed vscode.

Tried every possible way:

  1. the usual right click and open with... and then selecting "always use this app" option
  2. right click -> properties -> click change button for "Opens with:"
  3. Settings -> System -> Choose default apps by file type

After selecting vscode, for example for .py files, nothing changes. Also saw in latest vscode release notes that some sort of fancy icons were added when associated with vscsode which should happen by default now? Perhaps that update mucked things up? https://code.visualstudio.com/updates/v1_28#_file-icons-per-file-type

@dubeg
Copy link

dubeg commented Oct 22, 2018

There is a bug in the last two cumulative updates for 1803 that breaks the Open With dialog as well as other methods of changing the default file association. Perhaps this is the cause of this issue; at least it was mine.

If you look there, under Version 1803, you'll see that the two latest KBs are KB4462919 and KB4458469. If you have any of those, uninstall them, then try again to change the default app for your file. If it works, then I suggest hiding those KBs until a new update is released with (hopefully) a fix for this bug.

If you don't know how to hide an update, look here.

@joaomoreno joaomoreno changed the title unable to associate .txt file with listed VS Code on Windows 10 Unable to associate .txt file with listed VS Code on Windows 10 Oct 23, 2018
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug windows VS Code on Windows issues workbench-os-integration Native OS integration issues help wanted Issues identified as good community contribution opportunities labels Oct 23, 2018
@joaomoreno joaomoreno added this to the Backlog milestone Oct 23, 2018
@joaomoreno joaomoreno changed the title Unable to associate .txt file with listed VS Code on Windows 10 Unable to associate files with VS Code on Windows 10 Oct 23, 2018
@joaomoreno joaomoreno added important Issue identified as high-priority and removed help wanted Issues identified as good community contribution opportunities labels Oct 23, 2018
@joaomoreno joaomoreno modified the milestones: Backlog, October 2018 Oct 24, 2018
@joaomoreno
Copy link
Member

@joaomoreno joaomoreno added upstream Issue identified as 'upstream' component related (exists outside of VS Code) and removed important Issue identified as high-priority labels Oct 24, 2018
@joaomoreno joaomoreno modified the milestones: October 2018, Backlog Oct 24, 2018
@joaomoreno joaomoreno changed the title Unable to associate files with VS Code on Windows 10 Unable to associate files on Windows 10 Oct 24, 2018
@DragWx
Copy link
Contributor

DragWx commented Oct 24, 2018

Wow, that's a pain! That's absolutely it though, because I checked and found out Notepad++ suffers from the same problem.

Here's the thing though, if you register file associations using Notepad++'s preferences window, they apply in Windows Explorer just fine. I couldn't associate CPP files with NP++, but after I told NP++ to associate itself with CPP files, Windows allowed me to change CPP files to NP++ away from VS2015, and I can still change it back and forth even after turning the setting off in NP++. When trying with C files, which I'd never enabled and were also already assigned to VS2015, Windows wouldn't allow me to change it to NP++.

A similar thing happened with PHP files; which I didn't have a default editor for. Telling NP++ to assign itself to PHP files caused Windows to recognize it, and it's still set as the default editor for it even after I turned that setting back off.

Since VS Code offers no way to tell it to assign itself to file types, there's no way to apply this workaround for it. Still, it definitely seems like Windows isn't allowing you to set a program as default until the program registers itself with whatever Windows 10's mechanism for this is.

For sure, I hope a future windows update addresses this.

@mzhukovs
Copy link

hopefully... but sounds like they have much bigger fish to fry with the october 1809 release given it is still eating people's files.

@DragWx
Copy link
Contributor

DragWx commented Nov 28, 2018

There's a workaround!

  1. Download the installer for the latest VS Code (make sure it's the same type; system if you have a system install, user if you have a user install)
  2. One of the options is to have the installer associate supported filetypes with VS Code, make sure it's selected.
  3. Allow VS Code to be reinstalled.

I tried it with my system install, and all of my installed extensions and my preferences have remained intact so far, with the added bonus that I now have working filetype associations for VS Code.

Windows 10 might prompt you when you double click on a file, but will respect VS Code as a selection now.

@dubeg
Copy link

dubeg commented Nov 28, 2018

Funny that you commented on this issue again so recently. The Windows build 17134.441 (kb4467682) was released today with a fix, finally!

@garretwilson
Copy link
Author

I'm not sure that KB4467682 fixed the problem for me, but definitely after KB4471324 (the December 2018 update) I can now associate file types with VS Code. So this was a Microsoft Windows problem. Thanks for helping me try to track this down.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) windows VS Code on Windows issues workbench-os-integration Native OS integration issues
Projects
None yet
Development

No branches or pull requests

5 participants