Running
During development you'll often run the application in order to properly test it. After you've prepared the application directory, you can then register and launch the developed application.
In order to do this, you need to enable development mode on your PC. After that, the application needs to be registered before it can be launched.
Registering
Registering an application causes it to be installed in your system. It means that the application that you've previously prepared will be basically installed on your machine. You'll be able run it as you would other applications, but it is also debuggable if necessary.
The registration is done using the saker.appx.register()
build task which takes the output of the saker.appx.prepare()
task as the input.
$prepared = saker.appx.prepare(### ... ###)
saker.appx.register($prepared)
After running the above, you'll see that your application appears in your Start Menu. (If everything goes well.)
You are recommended to specify the AllowReinstall
parameter as well so in case of incompatible modifications, your application registration can proceed:
saker.appx.register(
$prepared,
AllowReinstall: true
)
The task uses the Add-AppxPackage PowerShell cmdlet to register the application.
Launching
After registering your app, you can launch it from the Start Menu, or in any way you like it. If you want to run it as part of your build process, use the saker.appx.launch()
build task:
$register = saker.appx.register(
$prepared,
AllowReinstall: true
)
saker.appx.launch($register)
The task accepts the output of the saker.appx.register()
task so it can make sure that the application is already registered before attempting to launch it.
You can also launch other applications by specifying their Application User Model ID:
# Launches the windows calculator
saker.appx.launch(Microsoft.WindowsCalculator_8wekyb3d8bbwe!App)
If you don't specify the ID part of the AUMID (!App in the case above), the launch task will attempt to figure it on its own.
The task uses the appxlauncher.exe tool to launch the applications.