MakeAppx Command Line
While Advanced Installer offers automation in terms of package creation via CLI or PowerShell, some developers might prefer the use of MakeAppx executable which is included in the Windows 10 SDK and can be used from a command prompt or a script file.
In fact, Advanced Installer takes advantage of MakeAppx during the creation of appx and msix packages in some places, and MakeAppx comes with Advanced Installer as well.
MakeAppx doesn’t create .appxupload and .msixupload files which are required to publish an application into the Microsoft Store. For that, you can use Advanced Installer, or Visual Studio.
- 1. General command line
- 2. Commands
- 3. Options
- 4. Example
1. General command line
So let’s have a look at what are the command lines which you can use with MakeAppx.
The general command line is:
MakeAppx <command> [options]
Of course, this depends on where MakeAppx is located in your case. In our example, we have it located here: "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\makeappx.exe". So you can directly call it, like:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64\makeappx.exe" <command< [options]
Or, you can first navigate to the folder which contains the MakeAppx with the CD command in Command Prompt.
2. Commands
The following commands can be used with MakeAppx:
Command | Description |
---|---|
pack | Creates a package |
unpack | Extracts all files from a package to a specified output directory |
bundle | Creates a bundle |
unbundle | Unpacks all packages from a bundle in a specified output directory |
encrypt | Creates an encrypted app package or bundle from the input package/bundle at the specified output package/bundle |
decrypt | Creates a decrypted app package or bundle from the input app package/bundle at the specified output package/bundle. |
3. Options
For each of the above command lines, the following options can be used:
Option | Description |
---|---|
/d | Specifies the input, output, or content directory. |
/l | Used for localized packages. The default validation trips on localized packages. This option disables only that specific validation, without requiring that all validation be disabled. |
/kf | Encrypts or decrypts the package or bundle using the key from the specified key file. This can't be used with /kt. |
/kt | Encrypts the or decrypts package or bundle using the global test key. This can't be used with /kf. |
/no | Prevents an overwrite of the output file if it exists. If you don't specify this option or the /o option, the user is asked whether they want to overwrite the file. |
/nv | Skips semantic validation. If you don't specify this option, the tool performs a full validation of the package. |
/o | Overwrites the output file if it exists. If you don't specify this option or the /no option, the user is asked whether they want to overwrite the file. |
/p | Specifies the app package or bundle. |
/v | Enables verbose logging output to the console. |
/? | Displays help text. |
4. Example
As mentioned, the options mentioned above are compatible with all the available commands for MakeAppx. For example, if we want to create a simple MSIX package using the utility, this is the command line that must be used:
makeappx.exe pack /d “your directory” /p “output path”
Your input directory must contain the appropriate necessary APPX/MSIX file structure in order for the package to be built. One example can be the package manifest (AppxManifest.xml). If this is missing from inside the input directory, the build will fail.
Once we run the command, the package should be created and the msix output should be present in the desired directory.
MakeAppx does not offer the possibility to digitally sign APPX/MSIX packages. In order to digitally sign your package, the SignTool.exe must be used.
MSIX and APPX packages are basically “zip” files if you want to perceive them like this, and technically the contents can be extracted with any archiving tool like 7-zip. However, MakeAppx does provide the option to unpack. For example, we can use the following command line to extract the contents of our previous MSIX:
makeappx.exe unpack /p "package location" /d "package output directory"
The result of the command will look something like this:
One last example we need to look at is the bundle option. Bundles are similar to an app package, but bundles can reduce the size of the app that users download. To create a bundle with MakeAppx, we can use the following command line:
MakeAppx bundle /v /d "files directory" /p “output location”