Forum Discussion
Skinheed
May 10, 2021Copper Contributor
Issues with PowerShell start and end scripts
I think there is a problem with the PSFLauncher.exe. It appears to be using the working directory of the application shortcut to find the StartingScriptWrapper.ps1. This is breaking PowerShell suppor...
- May 13, 2021
Hi Skinheed
I am Bogdan, from the Advanced Installer team. Thanks for reporting this issue. Just wanted to let you know that until a fix is included by MSFT in the official PSF repo we will include a custom fix directly inside our next version.
Until then, you have a workaround in Advanced Installer:
Advanced Installer allows you to update the working directory and application parameters (that you would usually specify in the "Application Details" view) directly from the PS1 script.
For your scenario, please follow these steps.- Go to "Application Details > Working directory" and make sure this field (Working Directory) is empty.
- Use a PS script that updates the Working directory, attached is a sample.
This sample PS script (from the attached zip) updates the Working directory to the first argument it receives (its value should be relative to APPDIR).
IMPORTANT, when using the above script:
- change the script to include your own ApplicationID.
- set the desired working directory path (relative to APPDIR) in the 'scriptArguments' field.
The Working Dir argument can also be changed directly from inside your PS1 script, if you wish to hardcode it inside the script. - set the 'waitForScriptToFinish' field to 'true'
Let me know if this helps.
Darren_Hoehna
Microsoft
May 12, 2021Skinheed
Thank you for posting in our forums. Thank you for bringing up this issue with PSF. The expected behavior for Powershell scripts is the root of the application directory, not the directory of the shortcut. This is an issue with PSF and would need to be fixed.
Can you please make an issue on the MSIX_PackageSupportFramework github repo here: https://github.com/microsoft/MSIX-PackageSupportFramework/issues. This is where all the issues for PSF are being tracked.
Thanks,
Darren.
Thank you for posting in our forums. Thank you for bringing up this issue with PSF. The expected behavior for Powershell scripts is the root of the application directory, not the directory of the shortcut. This is an issue with PSF and would need to be fixed.
Can you please make an issue on the MSIX_PackageSupportFramework github repo here: https://github.com/microsoft/MSIX-PackageSupportFramework/issues. This is where all the issues for PSF are being tracked.
Thanks,
Darren.
- May 13, 2021Darren,
I have gotten the same issue/request from another customer. PsfTooling is unable to place the file at the root folder since it doesn't exist yet. A modification to the launching code will be needed to allow for this case. It's actually a lot like the config.json file location issue I previously fixed. TMEditX does add these to the root folder of the package so it doesn't have this problem with scripts.