Notepad++ UWP package in Windows store - almost there



  • 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?



  • Besides, Windows 7 still has 46.63% usage, according to https://www.netmarketshare.com/operating-system-market-share.aspx?qprid=10&qpcustomd=0, and Windows 10 only has 29.26% usage.

    You don’t want to abandon more than half the market overnight, now do you? :)



  • I just posted all of my instructions to build an AppX with my tweaks and improvements on GitHub. I will post a copy here.

    Instructions:

    1. Make sure a proper base image is installed, run DesktopAppConverter app as Admin.
    2. In this example, directory system looks like:
    • Downloads
      • npp.7.5.1.Installer.exe
      • notepad++ (folder)
        • npp.build (folder, always use for current build)
          • cert.pfx
          • mynamehere.cer
          • PackageFiles (folder)
            • Assets (folder)
            • localization (folder)
            • plugins (folder)
            • VFS (folder)
            • notepad++.exe
            • AppxManifest.xml
            • [Various other system-generated files…]
        • npp.build.11.10.2017 […]
        • npp.build.11.09.2017 […]
    1. Always rename a build, once completed, to have the date added at the end. This is important - the “npp.build” folder should only be used for latest build.
    2. Run command similar to this from Downloads folder:
    DesktopAppConverter.exe -Installer npp.7.5.1.Installer.exe -InstallerArguments "/S /noUpdater" -Destination notepad++ -PackageName "npp.build" -Publisher "CN=GJSMan" -Version 7.5.1.0
    
    cd notepad++\np.build\PackageFiles
    
    1. Now, copy the AppxManifest.xml file from the previous build, overwriting the AppxManifest.xml that is in the current folder. If this is your first build, don’t do this, and edit AppxManifest.xml to match the file listed at the bottom of this post.
    cp ../../npp.build.11.10.2017/AppxManifest.xml AppxManifest.xml
    
    1. Edit the newly-copied AppxManifest.xml file, updating the version number on line 3. Don’t make any other modifications.

    2. Make the AppX:

    cd ..
    
    MakeAppx pack /v /h SHA256 /d "PackageFiles" /p Notepad++.appx
    

    NOTE: When doing this for the first time, you must add C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\x86 to the Path attribute in Environment Variables for this to work, and restart PowerShell.
    If you are using a different build than 16299, you should open the folder in File Explorer and adjust accordingly.

    1. Sign the AppX, so you can install and test:
      A) Copy the certificate already generated (see below if this is your first time) from your previous build into the npp.build folder.
      B) Run:
    signtool sign /fd SHA256 /a /f mycert.pfx /p MYSECRETPASSWORDHERE MyPackage.appx
    

    If doing this for the first time, you must generate a private certificate on your computer, then copy the .pfx and .cer files into the npp.build folder, then use that to sign.

    • To clarify, the .cer is the public key (the exported one), whereas the .pfx is used for signing and is private.
    • You must have the Environment Variable in Step 7 set for this to work.
    • You only need to generate the certificate one time. After this, again, just copy-and-paste the certificate from the previous build into the new one.

    To generate the certificate (if this is your first build):
    A) New-SelfSignedCertificate -Type Custom -Subject "CN=<YourNameHere>" -KeyUsage DigitalSignature -FriendlyName <Your Friendly Name> -CertStoreLocation "Cert:\LocalMachine\My"
    B) Set-Location Cert:\LocalMachine\My
    C) Get-ChildItem | Format-Table Subject, FriendlyName, Thumbprint
    D) $pwd = ConvertTo-SecureString -String <Your Password> -Force -AsPlainText
    E) Export-PfxCertificate -cert "Cert:\LocalMachine\My\<Certificate Thumbprint>" -FilePath C:\Users\myname\Downloads\notepad++\npp.build\cert.pfx -Password $pwd
    F) cd C:\Users\myname\Downloads\notepad++\npp.build
    G) Open “Manage Computer Certificates” from Search box in Windows 10.
    H) Double click “Personal” > “Certificates”
    I) Right click, “All Tasks” > Export
    J) Next, “No, I do not want to export the private key”, “DER Encoded Binary”, and save to C:\Users\myname\Downloads\notepad++\npp.build\mynamehere.cer. “Next”, “Finish.”
    K) Update your AppxManifest.xml file to use “CN=YourNameHere” and update your publisher names in that file.
    L) Go to the top, part B above this. Run signtool using your newly-generated .pfx.

    1. Double click the .cer once signed, and Install it to “Trusted People.”
    2. Double click the .appx just generated, and click Install.

    Additional Notes:

    This is the default AppX. When building a build for the first time, you must copy and paste this AppX over the generated one.

    <?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:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:rescap3="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities/3" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:desktop2="http://schemas.microsoft.com/appx/manifest/desktop/windows10/2" xmlns:com="http://schemas.microsoft.com/appx/manifest/com/windows10" xmlns:wincap3="http://schemas.microsoft.com/appx/manifest/foundation/windows10/windowscapabilities/3" IgnorableNamespaces="uap4 wincap3 rescap3 desktop2 com">
      <Identity Name="npp.build" ProcessorArchitecture="x86" Publisher="CN=GJSMan" Version="7.5.1.6" />
      <Properties>
        <DisplayName>Notepad++</DisplayName>
        <PublisherDisplayName>GJSMan</PublisherDisplayName>
        <Logo>Assets\StoreLogo.png</Logo>
      </Properties>
      <Resources>
        <Resource Language="en-us" />
        <Resource uap:Scale="100" />
        <Resource uap:Scale="125" />
        <Resource uap:Scale="150" />
        <Resource uap:Scale="200" />
        <Resource uap:Scale="400" />
      </Resources>
      <Dependencies>
        <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.16299.15" />
      </Dependencies>
      <Capabilities>
        <rescap:Capability Name="runFullTrust" />
        <Capability Name="internetClient" />
      </Capabilities>
      <Applications>
        <Application Id="npp.build" Executable="notepad++.exe" EntryPoint="Windows.FullTrustApplication">
          <uap:VisualElements DisplayName="Notepad++" Description="npp.build" BackgroundColor="transparent" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png">
            <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square310x310Logo="Assets\Square310x310Logo.png" Square71x71Logo="Assets\Square71x71Logo.png">
              <uap:ShowNameOnTiles>
                <uap:ShowOn Tile="square150x150Logo" />
                <uap:ShowOn Tile="wide310x150Logo" />
                <uap:ShowOn Tile="square310x310Logo" />
              </uap:ShowNameOnTiles>
            </uap:DefaultTile>
          </uap:VisualElements>
          <Extensions>
            <uap3:Extension Category="windows.appExecutionAlias" Executable="notepad++.exe" EntryPoint="Windows.FullTrustApplication">
              <uap3:AppExecutionAlias>
                <desktop:ExecutionAlias Alias="notepad++.exe" />
              </uap3:AppExecutionAlias>
            </uap3:Extension>
    		<uap:Extension Category="windows.fileTypeAssociation">
              <uap3:FileTypeAssociation Name="npp.build">
    		   <uap:SupportedFileTypes>
                  <uap:FileType>.txt</uap:FileType>
                  <uap:FileType>.log</uap:FileType>
    			  <uap:FileType>.ini</uap:FileType>
    			  <uap:FileType>.inf</uap:FileType>
    			  <uap:FileType>.h</uap:FileType>
    			  <uap:FileType>.hh</uap:FileType>
    			  <uap:FileType>.hpp</uap:FileType>
    			  <uap:FileType>.hxx</uap:FileType>
    			  <uap:FileType>.c</uap:FileType>
    			  <uap:FileType>.cpp</uap:FileType>
    			  <uap:FileType>.cxx</uap:FileType>
    			  <uap:FileType>.cc</uap:FileType>
    			  <uap:FileType>.m</uap:FileType>
    			  <uap:FileType>.mm</uap:FileType>
    			  <uap:FileType>.vcxproj</uap:FileType>
    			  <uap:FileType>.vcproj</uap:FileType>
    			  <uap:FileType>.props</uap:FileType>
    			  <uap:FileType>.vsprops</uap:FileType>
    			  <uap:FileType>.manifest</uap:FileType>
    			  <uap:FileType>.java</uap:FileType>
    			  <uap:FileType>.cs</uap:FileType>
    			  <uap:FileType>.pas</uap:FileType>
    			  <uap:FileType>.pp</uap:FileType>
    			  <uap:FileType>.inc</uap:FileType>
    			  <uap:FileType>.html</uap:FileType>
    			  <uap:FileType>.htm</uap:FileType>
    			  <uap:FileType>.shtml</uap:FileType>
    			  <uap:FileType>.shtm</uap:FileType>
    			  <uap:FileType>.htaccess</uap:FileType>
    			  <uap:FileType>.asp</uap:FileType>
    			  <uap:FileType>.aspx</uap:FileType>
    			  <uap:FileType>.css</uap:FileType>
    			  <uap:FileType>.js</uap:FileType>
    			  <uap:FileType>.json</uap:FileType>
    			  <uap:FileType>.jsm</uap:FileType>
    			  <uap:FileType>.jsp</uap:FileType>
    			  <uap:FileType>.php</uap:FileType>
    			  <uap:FileType>.php3</uap:FileType>
    			  <uap:FileType>.php4</uap:FileType>
    			  <uap:FileType>.php5</uap:FileType>
    			  <uap:FileType>.phps</uap:FileType>
    			  <uap:FileType>.phpt</uap:FileType>
    			  <uap:FileType>.phtml</uap:FileType>
    			  <uap:FileType>.xml</uap:FileType>
    			  <uap:FileType>.xhtml</uap:FileType>
    			  <uap:FileType>.xht</uap:FileType>
    			  <uap:FileType>.xul</uap:FileType>
    			  <uap:FileType>.kml</uap:FileType>
    			  <uap:FileType>.xaml</uap:FileType>
    			  <uap:FileType>.xsml</uap:FileType>
    			  <uap:FileType>.sh</uap:FileType>
    			  <uap:FileType>.bsh</uap:FileType>
    			  <uap:FileType>.bash</uap:FileType>
    			  <uap:FileType>.nsi</uap:FileType>
    			  <uap:FileType>.nsh</uap:FileType>
    			  <uap:FileType>.lua</uap:FileType>
    			  <uap:FileType>.pl</uap:FileType>
    			  <uap:FileType>.pm</uap:FileType>
    			  <uap:FileType>.py</uap:FileType>
    			  <uap:FileType>.rc</uap:FileType>
    			  <uap:FileType>.as</uap:FileType>
    			  <uap:FileType>.mx</uap:FileType>
    			  <uap:FileType>.vb</uap:FileType>
    			  <uap:FileType>.vbs</uap:FileType>
    			  <uap:FileType>.f</uap:FileType>
    			  <uap:FileType>.for</uap:FileType>
    			  <uap:FileType>.f90</uap:FileType>
    			  <uap:FileType>.f95</uap:FileType>
    			  <uap:FileType>.f2k</uap:FileType>
    			  <uap:FileType>.tex</uap:FileType>
    			  <uap:FileType>.sql</uap:FileType>
    			  <uap:FileType>.nfo</uap:FileType>
    			  <uap:FileType>.mak</uap:FileType>
                </uap:SupportedFileTypes>
                <uap2:SupportedVerbs>
                  <uap3:Verb Id="Edit" Parameters="&quot;%1&quot;">Edit with Notepad++</uap3:Verb>
                </uap2:SupportedVerbs>
              </uap3:FileTypeAssociation>
            </uap:Extension>
          </Extensions>
        </Application>
      </Applications>
    </Package>
    

    Copy and paste this in to AppxManifest.xml for the first build.
    To clarify, you must copy this over the AppxManifest.xml file on your first build, then copy the AppxManifest.xml from the previous build every time you make a new build.



  • @Alan-Kilborn

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

    Not sure about what are you talking about. If you’re talking about the way to get Notepad++ installed, there will be the same distribution way via notepad-plus-plus.org, plus Windows Store’s distribution. So users have more choice.



  • @Claudia-Frank

    DesktopAppConverter -Cleanup "All" -Verbose
    

    works well, and install the new image without problem. Thank you.

    I’ll let you know if I can make an UWP package.



  • @gjsman

    I have tried Windows convension Bridge several times, I have never managed to get UWP from it. In anyway, it’s impossible to build any distribution from a 3rd party server, not only for the reliability reason, but also for the security reason.

    Thank you very much for the very detail info. It helps me a lot.



  • @donho

    “In anyway, it’s impossible to build any distribution from a 3rd party server, not only for the reliability reason, but also for the security reason.”

    What do you mean? Do you mean that Notepad++ remixes can’t be built? Or are you talking about something else?

    “Thank you very much for the very detail info. It helps me a lot.”

    Great! I don’t want to make things to complicated, and you can just use that simple command, but it won’t be an ideal experience without the modifications I put in those instructions (the main change is that you can open files from File Explorer, because file associations as they were done in the past don’t work, and without this you would have to go File > Open for every file you wanted to open).

    If you need additional help let me know. :)



  • “I have tried Windows convension Bridge several times, I have never managed to get UWP from it.”

    @donho With the conversion bridge, you CAN use UWP APIs, XAML, and more features (You just have to code for it)

    https://docs.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-extend

    Here is some supplied (example) C++:

    DllExport bool __stdcall LaunchMap(double lat, double lon)
    {
      try
      {
        String ^str = ref new String(L"desktopbridgemapsample://");
        Uri ^uri = ref new Uri(
          str + L"location?lat=" + lat.ToString() + L"&?lon=" + lon.ToString());
    
        // now launch the UWP component
        Launcher::LaunchUriAsync(uri);
      }
      catch (Exception^ ex) { return false; }
      return true;
    }
    


  • @donho If you meant that you never got a successful result from the bridge, that is odd. In my case, the biggest issue I had was needing Windows 10 Pro (because Home doesn’t include Hyper-V).

    So, goal here: Getting the basic UWP package working. When you get basic UWP builds working (without modifications), I would actually publish it to the Store like that. Improvements that require more build steps (like my modifications) can come later. :)

    Remember, Desktop-converted apps require special permission from Microsoft to be published. They charge $19 for an Individual’s Store account (this is for everyone), and they don’t charge for publishing converted Desktop apps, but they do require you fill out a special form asking for permission. After all, desktop apps (even packaged as UWP) still have far more control over the system than regular, new UWP apps do.

    https://developer.microsoft.com/en-us/windows/projects/campaigns/desktop-bridge

    In fact, Microsoft would prefer you filled out this form sooner than later, by the sound of it. It is also implied that they will help with any problems or questions. Also, they have a tendency to actually seek out apps they deem important and ask their developers to bring them to the store - they would probably really want you to bring Notepad++ to the store and would probably be more than happy to help you.



  • @donho Any luck?



  • I @donho I’m Francesco from UWP Open Source Community, I see that you are working hard on conversion…but I don’t understand why you can’t complete the first step…would you restart from a blank canvass with us( @gjsman @claudia-frank )?
    Futhermore, with the last windows update (Fall Creator Update) is possible distribute UWP also in your own website, check here:
    https://blogs.msdn.microsoft.com/appinstaller/2017/09/26/uwp-app-installs-from-web-via-app-installer/[link text](link url)


Log in to reply