UPDATE: Starting with Advanced Installer v19.3 you can include a desktop shortcut in an MSIX package by simply creating the shortcut in "Desktop" folder from "Files and Folders" section of your setup project.
When using previous Advanced Installer versions please use the workaround exposed below:
An MSIX package does not have built-in support to deploy a desktop shortcut, but using the "AppCompat" support in Advanced Installer you can include in an MSIX package a script that can create a shortcut to your application.
The current workaround solution uses the approach Microsoft exposed in "Create an application shortcut by running a script using Package Support Framework" article.
To implement this workaround you should include into your MSIX package:
1. a shortcut file configured to point to your application alias
2. a Start PowerShell script that all it does is to run once (when your application is first launched after MSIX installation) and copy the shortcut on Desktop location.
Here you can find a sample project attached.
Let's suppose you have a WindowsFormsApp.exe desktop app that you package into an MSIX package created with an Advanced Installer setup project.
To include a desktop shortcut into your MSIX package here are the steps to proceed with:
1. open your setup project in Advanced Installer and go to "Declarations" tab
2. use the [Add Application Declaration] -> "App Alias" toolbar button to create an alias for your app (e.g. WindowsFormsApp.exe)
3. build and install the MSIX setup project on your build machine
4. open Windows Run window ([Win] + [R]) and type in your app alias (e.g. WindowsFormsApp.exe); make sure your app successfully launches through your WindowsFormsApp.exe alias call after MSIX installation
5. now create a shortcut (e.g. WindowsFormsApp.lnk) pointing to your app alias (e.g. pointing to WindowsFormsApp.exe alias) and test it to make sure it successfully launches your app
6. open in Windows Explorer the Application Data location of your installed MSIX package and copy in there the icon file you want to set for your shortcut, e.g. under path like this:
Code: Select all
%localappdata%\Packages\DemoPackage.MSIXDesktopShortcut_8njdae5dphm2p\LocalCache\Roaming\fooIcon.ico
7. right click on shortcut file and choose "Properties"
8. set the "Target" and "Start in" fields to "%localappdata%\Microsoft\WindowsApps\WindowsFormsApp.exe", respectively "%localappdata%\Microsoft\WindowsApps"
9. click on [Change Icon] button and set the icon for your shortcut to icon file placed in Application Data location of your installed MSIX package, e.g.
Code: Select all
%localappdata%\Packages\DemoPackage.MSIXDesktopShortcut_8njdae5dphm2p\LocalCache\Roaming\fooIcon.ico
11. uninstall the installed MSIX package and go back to your setup project in Advanced Installer
12. go to "Files and Folders" page and add your WindowsFormsApp.lnk shortcut file (using [Add Files] toolbar button) under "Application Folder" directory; do not import the shortcut file in Windows Installer format; also add the shortcut icon file (e.g. fooIcon.ico) under "User Profile > Application Data" directory
13. go to "AppCompat" page and add a "Start PowerShell Script" configured with these flags: RunOnce: true, ShowWindow: false, WaitForScriptToFinish: true and pointing to a .ps1 script with this code:
Code: Select all
Copy-Item "WindowsFormsApp.lnk" "$env:USERPROFILE\desktop\WindowsFormsApp.lnk"
All the best,
Daniel