Search code examples
c#visual-studio-2010registryfile-association

Programmatically add file association without admin rights in C#


Other people have asked similar questions but I want to clarify. I want to build my application without the need for administrative permissions when installing. For the file association I understand that I need to write in the registry but so far I have found two different locations in stackoverflow articles:

HKEY_CURRENT_USER\Software\Classes

and another under

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts

So which is one the right one?


Solution

  • You should use the former (HKCU\Software\Classes), because that's what Windows uses to open files.

    I'm not sure what the second one is used for; I believe it's only used to populate the recommended section of the Open With dialog.