Windows 11 - My Windows Explorer context menu item appears on the first menu but not on the second

23 Views Asked by At

I wrote a C++ application which should shows an item in the Windows Context menu, when the user right-clicks on a directory.

As my application also targets Windows 11, I wrote a Sparse Package, generated from the below app.manifest.

<?xml version="1.0" encoding="utf-8"?>
<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2"
  xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
  xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4"
  xmlns:desktop5="http://schemas.microsoft.com/appx/manifest/desktop/windows10/5"
  xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
  xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10"
  IgnorableNamespaces="uap uap2 uap3 rescap desktop desktop4 desktop5 uap10 com">
    <Identity Name="MyCompany.MyAppName" ProcessorArchitecture="x64" Publisher="CN=MyCompanyName, O=MyCompanyName, S=MyCompanyLocation, C=XX" Version="1.0.0.0" />
    <Properties>
        <DisplayName>My Application</DisplayName>
        <PublisherDisplayName>My Company</PublisherDisplayName>
        <Logo>Assets\storelogo.png</Logo>
        <uap10:AllowExternalContent>true</uap10:AllowExternalContent>
    </Properties>
    <Resources>
        <Resource Language="en-us" />
    </Resources>
    <Dependencies>
        <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.18950.0" MaxVersionTested="10.0.19000.0" />
    </Dependencies>
    <Capabilities>
        <rescap:Capability Name="runFullTrust" />
        <rescap:Capability Name="unvirtualizedResources"/>
    </Capabilities>
    <Applications>
        <Application Id="XXXXXXXXXXXXXSparsePackageReg" Executable="XXXXXXXXXXXXXSparsePackageReg.exe" uap10:TrustLevel="mediumIL" uap10:RuntimeBehavior="win32App">
            <uap:VisualElements AppListEntry="none" DisplayName="My App" Description="This is my app" BackgroundColor="transparent" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png">
                <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\LargeTile.png" Square71x71Logo="Assets\SmallTile.png"></uap:DefaultTile>
                <uap:SplashScreen Image="Assets\SplashScreen.png" />
            </uap:VisualElements>
            <Extensions>
                <desktop4:Extension Category="windows.fileExplorerContextMenus">
                    <desktop4:FileExplorerContextMenus>
                        <desktop5:ItemType Type="Directory">
                            <desktop5:Verb Id="MyMenuCmd" Clsid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" />
                        </desktop5:ItemType>
                        <desktop5:ItemType Type=".jpg">
                            <desktop5:Verb Id="MyMenuCmd" Clsid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" />
                        </desktop5:ItemType>
                    </desktop4:FileExplorerContextMenus>
                </desktop4:Extension>
                <com:Extension Category="windows.comServer">
                    <com:ComServer>
                        <com:SurrogateServer DisplayName="Do something with my app">
                            <com:Class Id="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" Path="MyAppDll.dll" ThreadingModel="STA"/>
                        </com:SurrogateServer>
                    </com:ComServer>
                </com:Extension>
            </Extensions>
        </Application>
    </Applications>
</Package>

The manifest above works well when I right-click on any .jpg file: I can see the menu item appear in both the first and second Windows 11 Windows Explorer context menu.

However this is not the case when I right click on a directory. I can indeed see the menu item appear in the FIRST Windows 11 menu

enter image description here

but not on the SECOND one (which appear when I click on "Show more options" in the first menu above).

enter image description here

I assume I'm doing something wrong in my manifest file. But I cannot figure out what exactly.

Can someone help me?

0

There are 0 best solutions below