Forum Discussion

bbelko's avatar
bbelko
Copper Contributor
Jan 25, 2024

MSIX file association - windows cannot find file error

I packages Notepad++ using MSIX packaging tool then edited xml manifest file. Within <application> tag I put:

<Extensions>
<uap:Extension Category="windows.fileTypeAssociation" EntryPoint="Windows.FullTrustApplication" Executable="notepad++.exe">
<uap:FileTypeAssociation Name=".txt">
<uap:EditFlags AlwaysUnsafe="false" OpenIsSafe="false" />
<uap:SupportedFileTypes>
<uap:FileType>.txt</uap:FileType>
</uap:SupportedFileTypes>
</uap:FileTypeAssociation>
</uap:Extension>

 

After package was installed I tried to open txt file and Windows ask me about default file association. I select Notepad++ and file was opened. All icons for txt files are now change and Notepad++ icon is visible on them. But when I double click on any txt file I got error

When I right click on txt file and choose Open With then Notepad++ the same error

 

Why is it so and how to troubleshoot it ?

 

2 Replies

  • Peer-Atle's avatar
    Peer-Atle
    Brass Contributor

    bbelko 
    Try this.
    <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4" xmlns:desktop5="http://schemas.microsoft.com/appx/manifest/desktop/windows10/5" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:desktop7="http://schemas.microsoft.com/appx/manifest/desktop/windows10/7" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10" IgnorableNamespaces="uap uap3 uap10 desktop desktop7 rescap com desktop4 desktop5">
    ....
    ..
    <Extensions>
    <desktop7:Extension Category="windows.shortcut">
    <desktop7:Shortcut File="[{Common Programs}]\Notepad++.lnk" Icon="[{Package}]\VFS\ProgramFilesX64\Notepad++\notepad++.exe" />
    </desktop7:Extension>
    ...
    ..

    On OS >= Win10. If you want Execution Alias. Add
    <uap3:Extension Category="windows.appExecutionAlias" EntryPoint="Windows.FullTrustApplication">
    <uap3:AppExecutionAlias>
    <desktop:ExecutionAlias Alias="notepad++.exe" />
    </uap3:AppExecutionAlias>
    </uap3:Extension>

    Add FileType Association (right click, open with Notepad++)
    <uap3:Extension Category="windows.fileTypeAssociation">
    <uap3:FileTypeAssociation Name="txt">
    <uap:SupportedFileTypes>
    <uap:FileType>.txt</uap:FileType>
    </uap:SupportedFileTypes>
    </uap3:FileTypeAssociation>
    </uap3:Extension>

    If you want context menu on all files. Add
    <com:Extension Category="windows.comServer">
    <com:ComServer>
    <com:SurrogateServer DisplayName="contextmenuhandlers">
    <com:Class Id="B298D29A-A6ED-11DE-BA8C-A68E55D89593" Path="VFS\ProgramFilesX64\Notepad++\contextMenu\Nppshell.dll" ThreadingModel="STA" />
    </com:SurrogateServer>
    </com:ComServer>
    </com:Extension>
    <desktop4:Extension Category="windows.fileExplorerContextMenus">
    <desktop4:FileExplorerContextMenus>
    <desktop5:ItemType Type="*">
    <desktop5:Verb Id="ContextMenuHandlers" Clsid="B298D29A-A6ED-11DE-BA8C-A68E55D89593" />
    </desktop5:ItemType>
    </desktop4:FileExplorerContextMenus>
    </desktop4:Extension>
    ...
    ..
    </Extensions>
    </Application>
    </Applications>
    <Capabilities>
    <rescap:Capability Name="runFullTrust" />
    </Capabilities>
    </Package>


Resources