Warning, /graphics/krita/packaging/windows/msix/README.md is written in an unsupported language. File is not indexed.
0001 (Originally written by Alvin on 2020-06-02 ~ 2020-06-03)
0002
0003 Documentation sources:
0004
0005 - https://docs.microsoft.com/en-us/windows/msix/desktop/desktop-to-uwp-manual-conversion
0006 - https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/appx-package-manifest
0007 - https://docs.microsoft.com/en-us/previous-versions/windows/dn934795%28v%3dwin.10%29
0008 - https://docs.microsoft.com/en-us/windows/uwp/design/style/app-icons-and-logos
0009
0010
0011 Assets
0012 ---
0013
0014 Most of the assets starts out extracted from the package that the MSIX
0015 Packaging Tool generated, with `fileicon.png` being the exception. Since the
0016 assets are target-based, we need to use `makepri` to generate a `pri` file.
0017
0018 The assets are placed under the `Assets` dir when inside the package, so this
0019 dir structure needs to be replicated. Also, in order to not mess up `makepri`,
0020 the `Assets` dir needs to be placed in its own dir with no other files in it.
0021 I chose to name it `pkg`.
0022
0023 I generated a `priconfig.xml` file using this command:
0024
0025 ```
0026 makepri.exe createconfig /cf priconfig.xml /dq en-us
0027 ```
0028
0029 ... however I also commented out the `packaging` section.
0030
0031 Read more about the app icons on https://docs.microsoft.com/en-us/windows/uwp/design/style/app-icons-and-logos
0032
0033 TODO: On editing the assets...
0034
0035
0036 Manifest
0037 ---
0038
0039 The manifest is constructed by referencing the official documentation and the
0040 two manifests generated by DAC (as in Krita 4.2.8 store version) and MSIX
0041 Packaging Tool. A huge portion is manually rewritten though.
0042
0043 There are several issues that couldn't be resolved:
0044
0045 - The property handler just doesn't work so it has been commented out.
0046 - Explorer doesn't add the drop shadow to the thumbnail. In Win32 there is a
0047 registry value to change it but there is no such option in the manifest.
0048 - Explorer doesn't load the preview image on the preview pane. In Win32 the
0049 image provided by the thumbnail handler is automatically used, but not for
0050 Appx for some reason?
0051
0052
0053 Building the MSIX
0054 ---
0055
0056 Needs:
0057
0058 - Latest Windows SDK (though I've tested with 10.0.17763.0 and10.0.18362.0)
0059 - Krita x64 NSIS installer EXE file
0060 - 7-Zip
0061 - The cert to sign the package with
0062
0063 Steps (if running manually):
0064
0065 1. Extract the EXE installer to somewhere **outside of the source tree** using
0066 7-Zip (don't run the installer!)
0067 2. Remove `$PLUGINSDIR` and `uninstall.exe.nsis`/`uninstall.exe` inside
0068 3. Copy `manifest.xml.in` into `manifest.xml` then make necessary amendments to
0069 it, including replacing the `@`-substitutions.
0070 4. Start a command prompt in this dir, then run
0071 `set KRITA_DIR=C:\path\where\you\extracted\the\Krita\files`, and then run
0072 `build_msix.cmd`.
0073 - If you need to specify the keyfile and password used to sign the MSIX
0074 file, execute the following command before running the final script:
0075 ```
0076 set SIGNTOOL_SIGN_FLAGS=/f "absolute_path_to_keyfile.pfx" /p password
0077 ```
0078 5. Install and test `out\krita.msix`
0079
0080 The script and related resources are also configured and installed into
0081 `${CMAKE_INSTALL_PREFIX}/krita-msix`, which is then used by the Binary Factory
0082 pipeline. On the Binary Factory, we also need to set `KRITA_SHELLEX` for it
0083 to copy the files required for the shell extension.
0084
0085
0086 Self-signing the package for testing purposes
0087 ---------------------------------------------
0088
0089 1. Make a backup of the built package if needed. You will **not** be able to remove the signature after it has been added.
0090 2. Generate a fake certificate for signing by running this command in PowerShell:
0091 ```
0092 New-SelfSignedCertificate -Type Custom -Subject "CN=03E730BB-6849-4762-9BDB-10CD7FFDB2C1" -KeyUsage DigitalSignature -FriendlyName "Fake Krita Foundation certificate for debugging only" -CertStoreLocation "Cert:\CurrentUser\My" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3", "2.5.29.19={text}")
0093 ```
0094 This command will add the certificate into your 'Personal' storage.
0095 3. Go to 'Manage User Certificates' Windows applet. Export the key into a .ppk file
0096 4. Go to 'Manage Computer Certificates' (needs Administrator rights)
0097 5. Import your .ppk file into "Trusted Root Certificates" storage.
0098 6. Copy the certificate (by Ctrl+D&D) into "Trusted Publishers" section.