Forum Discussion
MSIX Command Line Argument
Support for shortcut parameters is not yet supported in 1809, it should be in an upcoming Insider preview.
John.
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
- Bogdan MitracheApr 06, 2020Iron Contributor
Can you give us more details about the command line that you need to set? From what I see you said it depends on the target machine. Is it a file/folder path that can be different for each machine?
I am asking because in Advanced Installer we try to handle all these MSIX limitations with generic solutions that apply to multiple use cases. For example, now we are working on extending our private PSF fork to support expanding folder IDs or environment variables, like ProgramFilesFolder to "C:\Program Files". This path expansion can occur in a config file that gets installed or in a shortcut command line.
I am curious to better understand the specifics for your scenario.
Thanks,
Bogdan- BrettBurgesonApr 06, 2020Brass Contributor
Thank you for your response.
We are trying to replace our click once installers with an up to date installer platform.
We have customers that have multiple users that need to be able to install our application from a web server that our customers maintain. Currently the click once link supplies an argument with a path to a config file. The path to the config file is of course unique to the customer but not to each machine.
We need to do the same thing with our new installer. MSIX can do that with the PSF but the package needs to be opened and the config file updated with the argument specific to the customer and repacked. We would like to avoid that step if possible so we can just have our Azure Devops pipeline produce an installer that we don't have to open up to modify the argument.
One more thing is that MSIX requires the user of MSIX Core to install on versions earlier than Windows 10 build 1709. At this point I'm having trouble getting MSIX Core to build successfully.
Thank you,
Brett
- Bogdan MitracheApr 09, 2020Iron Contributor
For this scenario I am thinking you could do this in a different way.
First, when your customers host the MSIX file on their servers, their should make it available for download using an .appinstaller file. It's a simple XML which they can write.
Now, at runtime, your app can detect the link used by the appinstaller. You can use a simple PowerShell script to get that link and save it into the registry. Then using the PSF launcher you can read that link from the registry (every time your app launches) and launch your app with a different command line (or whatever the customization was made by your clients), depending on the link it reads.
Is this what you would like? (I can provide a sample script and demo project in Advanced Installer if you want)
- jvintzelMar 26, 2020Former Employee
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
- 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.
- BrettBurgesonMar 27, 2020Brass Contributor
That is awesome! Thank you for the update.