Creating a seamless user experience for an app often involves using shortcuts.
Desktop shortcuts provide a direct method of accessing any application. Now, the main question is: how can we? create a desktop shortcut for an application deployed via an MSI package?
This article has you covered. It will guide you through the process of creating a desktop shortcut for a Windows Forms application installed via an MSI package. We will use Visual Studio and Free Visual Studio Advanced Installer extension to build the installer.
Before moving on to the next steps, make sure you have the Advanced Installer add-in for Visual Studio installed. If not, you can find it in the Visual Studio Marketplace.
1. Create the application
Let’s start by creating an example Windows Forms application in Visual Studio:
- go to File → New → Project.
- Select Windows Forms application from the list of templates.
- Name your project and click Create.
2. Add the configuration project
Next, add the Configuration Project needed to create the MSI package:
- Right click on Project Solution → Add → New Project.
- unravel Advanced installer project template from the list of templates.
- Enter a name for the project and create it.
After creating the setup project, open the Advanced Installer Project (.aip) file to access and edit your installer details.
3. Add Project Product
Before we dive into creating the desktop shortcut, it’s essential to include the build output of your solution in the installer project:
- go to Files and Folders tab in the viewer and click on Add Project Product the button.
- In the opened dialog you need to select a publication profile and click OK the button.
If you do not yet have a published profile, you will be prompted to create one.
Choose to publish to a local folder. After configuring this profile, there is no need to publish anything manually – the configuration project will handle it automatically when you build it.
Then, go back to Files and Folders tab, click on Add Project Product again and select the publishing profile you just created.
4. Create the desktop shortcut for the Windows Forms application
To create the desktop shortcut, follow these steps in the Advanced Installer:
- Open your project in the Advanced Installer by clicking Switch to advanced installer button in the lower left corner of the project viewer.
- Navigate to Files and Folders page and find Application folder.
- Right click on the application executable file and select New shortcut for installed file.
- IN New file shortcut dialog, select Desktop folder HOW Shortcuts folderthen press OK the button.
After saving your project in the advanced installer, return to Visual Studio. You will be prompted to refresh the installer project since it has been modified. CLICK [Yes] the button.
5. Build and install the application
It’s time to build the configuration project to generate the MSI. Then, run it to install the app. Once the installation is complete, you will find the application shortcut on your desktop.