Support legacy context menus for packaged apps

The context menu is one of the most popular and useful shell extensions. If you are already in File Explorer or on the Desktop, it significantly reduces the number of steps to complete a file operation compared to opening a separate app.

If your desktop app implements the legacy IContextMenu interface for shell extensions such as the context menu handler or drag and drop handler, the shell extension might not work after you package your app. In order for shell to recognize and register the extension, you will need to modify the package manifest file. (This feature is available on Windows 11 build 22000+, which is currently available via Windows Insider builds)

  • Add com namespace and windows.comServer extension for your shellex dll


    Below is an example code snippet:

    <com:Extension Category="windows.comServer">
            <com:SurrogateServer DisplayName="<display-name-for-the-com-server>">
                <com:Class Id="<GUID-for-the-com-server>" Path="<path-to-the-com-server-or-dll>" ThreadingModel="STA" />
  • Add desktop9 namespace and the windows.fileExplorerClassicContextMenuHandler or windows.fileExplorerClassicDragDropContextMenuHandler extension


    Below is an example code snippet:

    <desktop9:Extension Category="windows.fileExplorerClassicContextMenuHandler">
            <desktop9:ExtensionHandler Type="*" Clsid="<GUID-for-the-com-server>" />
            <desktop9:ExtensionHandler Type=".txt" Clsid="<GUID-for-the-com-server>" />
            <desktop9:ExtensionHandler Type="Directory" Clsid="<GUID-for-the-com-server>" />
    <desktop9:Extension Category="windows.fileExplorerClassicDragDropContextMenuHandler">
            <desktop9:ExtensionHandler Type="Directory" Clsid="<GUID-for-the-com-server>" />
            <desktop9:ExtensionHandler Type="Drive" Clsid="<GUID-for-the-com-server>" />
  • Change MaxVersionTested to be greater than 10.0.21300.0

    Below is an example code snippet:

        <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.21301.0" />


If you are implementing shell extensions instead of packaging an existing desktop app with legacy IContextMenu implementation, we suggest implementing the IExplorerCommand interface and using desktop4:FileExplorerContextMenus instead. Refer here for more information.