locked
[UWP]UWP App File Association RRS feed

  • Question

  • I have Windows CRC utility application that allows the user to generate the CRC for any file. On installation the app modifies the registry to allow the user to right on filename and select the utility from the File Explorer’s context menu.  I have packaged the app as a UWP using VS’ Window application Packaging Project.  How can I achieve the same functionally for the UWP version? 

    I have tried adding a file associations in “Package.appxmanifest  Declarations” in VS and the app shows up in “File Explorer’s Open With” menu but I need all file types and the “Declaration File Type Associations” in VS does not allow the .* file type and will not allow file types like .exe, .com, etc.. 


    Thursday, January 24, 2019 9:02 PM

Answers

  • Yes the simple answer is it not supported in UWP.  I will mark this answered and I have add my input to the feature requests.
    • Marked as answer by Bob Bryant Wednesday, February 13, 2019 7:12 PM
    Wednesday, February 13, 2019 7:12 PM

All replies

  • Hi,

    This is by design. According to the document Handle file activation and Reserved file and URI scheme names, it is mentioned that: “You can use URI associations to automatically launch your app when another app launches a specific URI scheme. But there are some URI associations that you can’t use because they are reserved. If your app registers for a reserved association, that registration will be ignored. This topic lists the reserved file and URI scheme names that are not available to your app.” 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 25, 2019 6:30 AM
  • Roy Thanks for the response.

    I looked at the “Handle file activation” link in your response and it states “Your app can register to become the default handler for a certain file type” I do not want to be the default file handler.  I only used this as an example in my original post to show the functionality I would like to include with the UWP version of the CRC app. What I am looking for as a way to add the UWP version of the CRC app to the Windows File Explorer Context menu’s “Open” listing to allow the user to right click on any file and select the UWP version of the CRC app from the context menu to launch, load, and calculate the CRC for the selected file.  For the WPF version of the CRC app, the installer modifies the Registry’s HKEY_CLASSES_ROOT\*\shell to add the app to the Window File Explorer Context menu’s “Open” listing to add this functionality.  Access to the app from the Windows File Explorer Context Menu is just a convenience that I have used for a number of utilities.  The user can always open the UWP CRC app and select the file to calculate the CRC over. Following are some of the apps on my system that can be executed from the File Explorer’s Context Menu: Print, Edit, 7-Zip, Edit with Notepad++, Select left file for Compare (Beyond Compare), Scan with Windows Defender..., etc.

    Note: I found a number of the reserved file types (.png, .rtf, .wmv, .icon, ico, .app, .asp, etc.) listed in the ”Reserved file and URI scheme names” link in your response that the VS Package.appxmanifest\Declarations did allow.

    Friday, January 25, 2019 9:25 PM
  • Hi,

    >>What I am looking for as a way to add the UWP version of the CRC app to the Windows File Explorer Context menu’s “Open” listing to allow the user to right click on any file and select the UWP version of the CRC app from the context menu to launch, load, and calculate the CRC for the selected file. 

    The Handle file activation is the right document for what your are looking for. The document tells how to set up your app to launch when a file of a certain type is opened. It says you can be the default handler,but it also requires that user chooses your app as the default handler for a certain file type. 

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 28, 2019 8:04 AM
  • Thanks

    >> The Handle file activation is the right document for what you are looking for. The document tells how to set up your app to launch when a file of a certain type is opened. It says you can be the default handler, but it also requires that user chooses your app as the default handler for a certain file type.

    I agree the Handle file activation document tells how to set up my app to launch when a file of a “certain” type is opened and I have done this for many file types as a test.  What I am looking for is away to set up my app to launch when a file of “any” type is opened. 

    Monday, January 28, 2019 6:32 PM
  • Hi,

    >>What I am looking for is away to set up my app to launch when a file of “any” type is opened. 

    The document Reserved file and URI scheme names in my previous reply has mentioned it clearly that some of the type is reserved by the system. So these types could not be used in UWP apps for file activation.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 29, 2019 2:38 AM
  • >> The document Reserved file and URI scheme names in my previous reply has mentioned it clearly that some of the type is reserved by the system. So these types could not be used in UWP apps for file activation.

    Is there a way in VS to create a UWP app that is added to the File Explorer Context Menu’s Open list when the app is installed?

    Tuesday, January 29, 2019 5:02 PM
  • Hi,

    >> Is there a way in VS to create a UWP app that is added to the File Explorer Context Menu’s Open list when the app is installed?’s Open list 

    After searching, there is a way to do that. But it still needs to register the file types to the manifest first. It is supported from Build 14393 on UWP. In the manifest file, you could use verb id to pass to your app as part of FileActivatedEventArgs and handle the user’s selection in OnFileActivated override in App.xaml.cs file.

    It looks like this:

     <uap:Extension Category="windows.fileTypeAssociation">
              <uap:FileTypeAssociation Name=".alsdkcs" DesiredView="useLess">
                <uap:SupportedFileTypes>
                  <uap:FileType>.alsdkcs</uap:FileType>
                  <uap:FileType>.crd</uap:FileType>
                </uap:SupportedFileTypes>
                <uap2:SupportedVerbs>
                  <uap3:Verb Id="Edit">Edit</uap3:Verb>
                  <uap3:Verb Id="Print">Print</uap3:Verb>
                </uap2:SupportedVerbs>
              </uap:FileTypeAssociation>
            </uap:Extension>

    This is a part of the manifest file that makes an app could be activated by the .crd and .alsdkcs file types. And it adds Edit and Print options to the File Explorer Context Menu. 


    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 30, 2019 1:47 AM
  • >>After searching, there is a way to do that.

    I have also seen the example manifest code in your reply and it sets my application as the default application for .alsdkcs and .crd file types.  It does add the verbs “Edit” and “Print” to the file explorer context menu’s “Open” list but only for the .alsdkcs and .crd file types.   My application needs read access to all file types and should never be set as the default application for any file type.  I guess “File Type Association” is not what I am looking for, since it implies an application is designed to work with a unique file type or group of file types and I need access for all file types. 

    Desktop applications can be added to the explorer context menu’s “Open” list during installation with a simple registry edit that allows the application to be selected by the user to launch and open the selected file or group of files regardless of the file types.  A commercial example of this is NotePad++.  After installation you can right click on any file or group of files (all I have tried) and select NotePad++ from file explorer’s context menu’s “Open” List to open the selected file or group of files. NotePad++ will open the selected file or files and display what it can. 

    From what I have found on the web and from our communications, UWP does not support explorer context menu access to a UWP application for all files like what is available for desktop applications.  I have also found post on the Developer Feedback requesting Shell Context Menus API for UWP apps dating back to May of 2016, so I am not the only one looking for this. If this is not correct please let me know.

    Thursday, February 7, 2019 1:38 AM
  • Hi,

    UWP apps are totoally different from desktop apps so UWP apps have different behaviors on this.

    >>I have also found post on the Developer Feedback requesting Shell Context Menus API for UWP apps dating back to May of 2016

    You could also vote for that feature quest. But as you could also see, this is not possible in UWP apps currently. Now the only way is to add the file types and SupportedVerbs in manifest file.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 13, 2019 7:10 AM
  • Yes the simple answer is it not supported in UWP.  I will mark this answered and I have add my input to the feature requests.
    • Marked as answer by Bob Bryant Wednesday, February 13, 2019 7:12 PM
    Wednesday, February 13, 2019 7:12 PM