How to modify registry in packaged WinUI project?

aluzi liu 486 Reputation points
2023-10-07T10:52:49.1566667+00:00

I am working on a packaged WinUI project.

And I need to launch the app from browser, so I need to write this to registry:

HKEY_CLASSES_ROOT\AppName\shell\open\command(Default)

The registry key value is:

"[TARGETDIR]AppName.exe" "%1"

So how to add this registry key when app is deployed?

(I work with WPF project before, I can create "Windows installer project", and then modify registry setting in installer project. But now is WinUI, there is no "Windows installer project" I can use...)

Windows development | Windows App SDK
0 comments No comments
{count} votes

Answer accepted by question author
  1. Xiaopo Yang - MSFT 12,736 Reputation points Microsoft External Staff
    2023-10-09T01:38:17.97+00:00

    Hello @aluzi liu,

    Use the windows.protocol extension. See Handle URI activation. For an example, see WinUIGallery.

    <uap:Extension Category="windows.protocol">
     <uap:Protocol Name="winui3gallery">
      <uap:DisplayName>WinUI 3 Gallery</uap:DisplayName>
     </uap:Protocol>
    </uap:Extension>
    

    User's image


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.