Notepad++ UWP package in Windows store - almost there



  • TL;NR
    It’s almost done, but it has been blocked - we need Microsoft (or UWP expert) support so we have a stable way to build UWP package for each release.

    I have managed to have a Notepad++ UWP package and have tested it in July 2017. However more work needed to be done in order to adapt Notepad++ to UWP package’s nature.
    In end of Auguest 2017, the adaptation has been finished so I released 7.5.1 for the desktop firstly. Afterward I’ve tried to build Notepad++ UWP package with the same command for Windows Store: surprise - the build failed with the following error:

    C:\WINDOWS\system32>DesktopAppConverter.exe -Installer C:\sources\notepad-plus-plus\PowerEditor\installer\build\npp.7.5.1.Installer.x64.exe -InstallerArguments /noUpdater -Destination C:\tmp -PackageName "Npp" -Publisher "CN=notepad-plus-plus.com" -Version 7.5.1.0 -MakeAppx
    C:\Program Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\DesktopAppConverter.ps1 :
    DesktopAppConverter : error 'E_STARTING_ISOLATED_ENV_FAILED': Failed to start the isolated environment. See inner
    exception for more details.
    At line:1 char:1
    + &'C:\Program Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,DesktopAppConverter.ps1
    
    Output Paths:
    
    Name                           Value
    ----                           -----
    CertPath
    PackageFilesPath
    PackagePath
    LogFilesPath                   C:\tmp\Npp\logs
    

    Here is the log: https://notepad-plus-plus.org/temp/DesktopAppConverter (1).log

    Then I try on the 2 others PC with another application that I have managed to build - same result.

    The different results on same configuration with the same installers to build makes me deduct the conclusion: the source of problem comes from Windows Update.

    Please let me know if anyone has any idea for why and how ( my email is don.h@free.fr ).



  • @donho

    maybe this does the trick.

    Cheers
    Claudia



  • @Claudia-Frank
    Unfortunately, no.
    The ink for downloading img in the link you provided is not available.
    I think there are some problems in Microsoft regarding this issue. :(



  • @donho

    oh, didn’t try the link and yes, seems that MS corrupted it.
    The base images can be downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=56049.

    Cheers
    Claudia



  • @donho What base image are you using to run the DesktopAppConverter?



  • @Claudia-Frank
    Thank you, The image has been downloaded. However, when I try to clean my old image, the error happened:

    C:\WINDOWS\system32>DesktopAppConverter -Cleanup "ExpandedImage" -Verbose
    COMMENTAIRES : Log file can be found in C:\Users\donh_000\AppData\Local\Temp\DesktopAppConverterCleanup.log
    COMMENTAIRES : Desktop App Converter 2.0.2.release_2017-04-20_15-32_d5d861e622cd5bd166242b726909575b22b31f27
    COMMENTAIRES : --------------------------------------------------
    
    
    Checking Prerequisites
    
    COMMENTAIRES : Checking Windows Version to ensure it meets minimum requirements
    COMMENTAIRES : Minimum Windows Version requirement is met.
    COMMENTAIRES : Testing for required feature enabled...
    COMMENTAIRES : Version de l’image cible 10.0.15063.0
    COMMENTAIRES : Required feature is enabled. Checking if reboot is required
    COMMENTAIRES : Version de l’image cible 10.0.15063.0
    COMMENTAIRES : Required feature is enabled.
    COMMENTAIRES : Version de l’image cible 10.0.15063.0
    COMMENTAIRES : Version de l’image cible 10.0.15063.0
    COMMENTAIRES : --------------------------------------------------
    
    
    Running Expanded image cleanup
    
    COMMENTAIRES : An error occurred converting your application. Here is the full error record:
    COMMENTAIRES :
    
    PowerShell Error Record:
    Impossible de trouver le chemin d'accès
    « C:\ProgramData\Microsoft\Windows\Images\BaseImage-15063\version.json », car il n'existe pas.
    PowerShell Stack Trace:
    à Remove-ExpandedBaseImage, C:\Program
    Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\converter_util\BaseImageOps.ps1 :
    ligne 207
    à <ScriptBlock>, C:\Program
    Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\converter_util\BaseImageOps.ps1 :
    ligne 246
    à Remove-AllExpandedBaseImages, C:\Program
    Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\converter_util\BaseImageOps.ps1 :
    ligne 246
    à <ScriptBlock>, C:\Program
    Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\Cleanup.ps1 : ligne 82
    à <ScriptBlock><Process>, C:\Program
    Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\DesktopAppConverter.ps1 : ligne 408
    à <ScriptBlock>, <Aucun fichier> : ligne 1
    
    Inner Exception[0]:
    System.Management.Automation.ItemNotFoundException: Impossible de trouver le chemin d'accès
    « C:\ProgramData\Microsoft\Windows\Images\BaseImage-15063\version.json », car il n'existe pas.
       à System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths,
     PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
       à System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext
    context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
       à System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean
    allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
       à System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean
    allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider&
    providerInstance)
       à System.Management.Automation.SessionStateInternal.CopyItem(String[] paths, String copyPath, Boolean
    recurse, CopyContainers copyContainers, CmdletProviderContext context)
       à Microsoft.PowerShell.Commands.CopyItemCommand.ProcessRecord()
    Inner Exception Stack Trace[0]
       à System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths,
     PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
       à System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext
    context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
       à System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean
    allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
       à System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean
    allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider&
    providerInstance)
       à System.Management.Automation.SessionStateInternal.CopyItem(String[] paths, String copyPath, Boolean
    recurse, CopyContainers copyContainers, CmdletProviderContext context)
       à Microsoft.PowerShell.Commands.CopyItemCommand.ProcessRecord()
    COMMENTAIRES : The full error record is saved in the logs at C:\Users\donh_000\AppData\Local\Temp
    C:\Program Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_x64__8wekyb3d8bbwe\DesktopAppConverter.ps1 : Impossible de trouver le chemin d'accès « C:\ProgramData\Microsoft\Windows\Images\BaseImage-15063\version.json », car il n'
    Au caractère Ligne:1 : 1
    + &'C:\Program Files\WindowsApps\Microsoft.DesktopAppConverter_2.0.2.0_ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,DesktopAppConverter.ps1
    

    Any idea?



  • @johnmurphy01
    BaseImage-15063.wim - which I’m trying to remove without success, as I described above.



  • @donho said:

    because of the WriteErrorException, did you run this as administrator?

    Cheers
    Claudia



  • @donho

    doesn’t this file exist? Then it looks like 15063 isn’t correctly installed.

    C:\ProgramData\Microsoft\Windows\Images\BaseImage-15063\version.json
    

    Cheers
    Claudia



  • @Claudia-Frank said:

    did you run this as administrator?

    Yes, the console was launched as administrator.



  • @donho

    I would give it a try to use option All like

    DesktopAppConverter -Cleanup "All" -Verbose
    

    but to be honest if I were you I would try to go in contact with MS as
    I’m pretty sure they would love to see npp on the store.

    Cheers
    Claudia



  • Current version of Desktop App Converter is 2.1.1.0. Maybe this version available via the MS Store fixes your issue. Additionally see this comment https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-run-desktop-app-converter

    If you’re using build number 15063, and the minor version of that build is equal to or greater than .483 (For example: 15063.540), make sure to download the BaseImage-15063-UPDATE.wim file. If the minor version of that build is less than .483, download the BaseImage-15063.wim file. If you’ve already setup an incompatible version of this base file, you can fix it. This blog post explains how to do that.

    https://blogs.msdn.microsoft.com/appconsult/2017/08/04/desktop-app-converter-fails-on-windows-10-15063-483-and-later-how-to-solve-it/



  • I did it! I have converted apps before, and did it fairly easily.

    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/3883

    My only concern is that the updater program might have to be removed, because updates come from Windows Store and an error would result if it tried to update itself (security reasons).

    https://user-images.githubusercontent.com/29414519/32677887-ce019db8-c625-11e7-9cfd-0e82aee4fa3a.png



  • I was actually looking at potential open-source desktop apps that would be good for the Windows Store, and came across Notepad++ and figured that would be good. So I did it, posted an issue to support it, only to discover you were already working on it. Perfect. :)

    Some notes:

    My command:

    DesktopAppConverter.exe -Installer npp.7.5.1.Installer.exe -InstallerArguments "/S" -Destination notepad++ -PackageName "NotepadPlusPlus" -Publisher "CN=GJSMan" -Version 7.5.1.0 -Sign -MakeAppx
    

    When I ran this command, my folder structure was:

    • Downloads (folder)
      • npp.7.5.1.Installer.exe (installer file)
      • notepad++ (folder where install files go on command run)

    I was running from a PowerShell with this directory, as administrator, and using the “Desktop App Converter” app from the Windows Store.



  • @Claudia-Frank said:

    DesktopAppConverter -Cleanup “All” -Verbose

    @donho The DesktopAppConverter -Cleanup "All" -Verbose command, I would recommend trying as well.

    I would give a few recommendations to other points here:

    • If you are having trouble removing a base image, try the command I just listed from @Claudia-Frank and see if it works.
    • I would recommend signing the package with -Sign, because then you can install the AppX generated certificate into “Trusted People” area, enable sideloading, and then test the AppX (whereas, if it isn’t signed even with this self-generated certificate, installation will fail)
    • If you are having particular trouble, do how I did it using a Virtual Machine. You just download VMWare, and then a copy of the latest Windows from https://www.microsoft.com/en-us/software-download/windows10 as an ISO. Believe it or not, you don’t need to activate Windows to have this method work.
    • Ideally, you would write a small script to run the Desktop App Converter command for you, because you might as well become good at running it (because you will run it every time you make a revision). Similar to .\build-appx.sh 7.0.0.0 or something simple.
    • When you submit your app, you may need special permission from Microsoft for desktop app submissions. This is free, but you will need to fill out a form at: https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge They will also help with the process if you need.


  • Well, that is done.

    Essentially, I would like to let you know something right now that I have discovered.

    The Desktop App Converter makes converting the basic app easy - sure. However, if you want to make really any modifications like changing the Display Name to support the ++ in the name, or you want to support opening .xml files (or any other file extension) from the “Open With” menu, it gets really complicated really quickly.

    Nonetheless, I have successfully packaged Notepad++ as appx. It will let you open any file (.xml or .php or whatever), and is signed with my personal certificate.

    If you want, I could put out instructions, but I warn you they were not easy to accomplish - took me a few hours experimentation, easily. You essentially have to take the package files, then modify the AppxManifest.xml file to support the file extensions you want, then generate a certificate on your computer (different from the ones -Sign makes), then make an Appx using MakeAppx.exe which is added to your System Environment Variables, then Package that AppX and sign it with signtool.exe. Not easy, but I did it.

    You might wonder, wasn’t it working before? It was, but you won’t be able to add extensible features to the package without the long list of complicated steps I just mentioned, for doing things like right-clicking an XML and seeing it under the "Open with " menu, or having a list of default-supported extensions. It will work, but many features that would greatly help out would be missing. You won’t be able to, say, double-click a file in File Explorer and have Notepad++ open it, for example. Desktop App Converter does only the basic stuff - it gets harder, quickly.

    If you like, perhaps I could just be the community packager for AppX files… I am here to answer any questions on request, and if you want an instruction guide I will write it.



  • A few photos, plus improvements to the package I have made:

    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/3883



  • I have a testing build up and with instructions. :)

    It is configured to open .rtf, .txt, and .xml files from File Explorer, if installed. You can see it at the bottom of the GitHub issue (link above)



  • I am on fire today. Sorry for inundating your email boxes!

    I released Revision 6 of a build. It supports all extensions except 3 (which I talked about on the GitHub issue). Removed updater as well. It works very well - good enough to publish! :)

    This is not a pure Desktop App Converter build. Rather, I take the files Desktop App Converter creates, then modify them to support a few additional, crucial features.

    • You can right-click any Notepad++ supported extension (except .cmd, .bat, and .hta) and find Notepad++ under the “Open With” menu, or set it as default. This is important because the conversion bridge does not support the old way of setting supported extensions (in fact, the whole File Extensions settings panel in Notepad++ doesn’t do anything with the UWP Bridge on). If this did not work, you could only open files from within Notepad++, and never from File Explorer.
    • Added the “Edit with Notepad++” menu item when right-clicking items. Unfortunately, due to the stronger security model on UWP Bridge apps, Notepad++ must have been set to default for that file extension already for the “Edit with Notepad++” menu item to appear. This makes it a little redundant, but I added it for backward-compatibility sake.

    I will make a few more revisions before I am happy with it. After that, I will either

    • Make a guide, explaining how the APPX design works best, and how to do this manually OR
    • (Hopefully) become a maintainer and submit APPX packages every time a new release comes out to @donho to manually upload to the Windows Store.


  • @donho

    I hope that the Windows store (ugh!) won’t be the ONLY way to get Notepad++ moving forward…



  • @Alan-Kilborn No, it shouldn’t be. This takes the .exe file (already generated) that is currently used, and then packages it up. So you would have to make a regular installer anyway to use this method. Which, at that point, why stop supplying it if you are going to do it anyway?


Log in to reply