Forum Discussion
MSIX Command Line Argument
Is there any update on allowing parameters to be specified to the MSIX package that get passed on to the installed application? My application needs environment specific data on the command line that can be different for each installation environment without creating a whole new package for each environment.
Thank you, Brett
It is supported using the package support framework (http://aka.ms/msix-psf). We are working on a more detailed implementation doc for this on the main docs site (http://aka.ms/msix). We hope to have that live (with a couple other psf docs) next week.
John.
- BrettBurgesonMay 18, 2020Brass Contributor
jvintzelHi John, I see from the article here:
https://docs.microsoft.com/en-us/windows/msix/psf/psf-launch-apps-with-parameters
we can put arguments into the config.json file inside the package to have the Launcher64.exe pass those arguments to the installed application when it is launched.
What I need to do is pass a query string to the MSIX package from a link on a web page using the appinstaller and have that query string passed as an argument to the installed application when it is launched. Is there a way to do this?
Thank you,
Brett Burgeson
- Bogdan MitracheOct 06, 2020Iron Contributor
Hi BrettBurgeson,
It seems you can now pass query params to your applications deployed via an MSIX and the App Installer
- Passing installation parameters to a Windows application with MSIX and App Installer
Bogdan
- BrettBurgesonOct 06, 2020Brass Contributor
Bogdan Mitrache That is good news. Thank you for the update.
- May 28, 2020
I have been thinking about your scenario further, and have a suggestion for your consideration.
If I understand the problem correctly, in the end, your request is one about modifying the behavior of the application based on information that is only available at the time of installation. Before MSIX, this was accomplished by building a specialized shortcut at the time of the installation that added command line parameters with the required information obtained from the query string.
We have been discussing ways to get the equivalent using the Psf, but this might not be the best way. While it is "nice" to think about keeping everything inside the package, you should consider having the package be generic and having the installation experience configure an external reference with the needed data.
For this to work, the package shortcut would go to a launcher program that would read this data and start the app with appropriate command line arguments. This could be an special exe someone writes, or you could use PsfLauncher to start a cmd file with that logic.
As to the data, that could be placed in a native file or registry. Your installation experience would be one that creates the data file/reg from the query string and then just runs AppInstaller to install the app. This might not be a pure "MSIX" approach, but it might get the job done.
- BrettBurgesonMay 28, 2020Brass Contributor
- jvintzelMay 18, 2020Former Employee
Right now we do not support passing an argument from the installation URI to an installed app. Its something that we talked about, but not available today. I recommend adding an Feature Idea to the ideas section of the community.
https://aka.ms/msix-ideas
John Vintzel (@jvintzel)
PM Lead, MSIX
- BrettBurgesonMay 06, 2020Brass Contributor
jvintzelI'm trying to find out how to use the package support framework to accept a query string when launched from a web site and pass that query string to the installed application as a command line argument. Is there someplace in the documentation that will help me accomplish this?
Thank you,
Brett
- May 11, 2020
BrettBurgeson Getting the arguments is fairly straightforward using the PSF. You'll add a copy of the PsfLauncherXXX.exe to the package and configure the config.json for that application to launch your app. I haven't run this test case in a while, but the launcher should be appending any arguments listed for the app arguments in the json, plus any that were passed into the launcher. So leave the arguments out of the json file. Of course, if you don't need the PSF for other purposes, you can skip the Launcher and just target your end application as per below.
The trickier part is getting the things you need to run (PsfLauncher or target). It's bad to hard code the package path, so a powershell script to query for install packages and getting the install folder from there and appending the Psflauncher or target name for the command line and adding your query string there will do it.
- BrettBurgesonMay 15, 2020Brass Contributor
TIMOTHY_MANGANI'm not having any success getting arguments passed to the installed application.
I added PsfLauncher64.exe and PsfRuntime64.dll to my InstallerPackageProject and I modified the config.json to execute my application being installed and left out the arguments. I also modified Package.appxmanifest to execute PsfLauncher64.exe.
The appx package installs my application and launches it but does not pass any arguments to the installed application when it is launched by the installer. I have run the appx package two ways. First with a shortcut containing command line arguments. The second way is from a web page link that has a query string containing my arguments using the appinstaller.
I'm really only interested in running the install from a web page using the appinstaller. I want to pass arguments as a query string. I am not interested in the install folder location.
You probably need more information to understand what I may be doing wrong.
Let me know what else I can tell you.
Thank you for your help.
Brett
- BrettBurgesonMar 27, 2020Brass Contributor
That is awesome! Thank you for the update.