In Visual Studio (including the free community editions) you can install the Microsoft Visual Studio Installer Projects
extension [1] which allows you to create an MSI installation package. To install it from within Visual Studio:
- Go to
Extensions
-> Manage Extensions
in the menu bar
- Search for
Installer Projects
in the search box
- Select
Microsoft Visual Studio Installer Projects
and hit Download
- Restart Visual Studio
Once the extension is installed, you'll create a new project that will contain all of the files and settings for the MSI. To do this:
- Go to
File
-> New
-> Project
in the menu bar
- Change the drop down menus visible to show
All languages
, All platforms
, and All project types
respectively
- Scroll down in the project type list and towards the bottom select
Setup Wizard: Create a Windows Installer project with the aid of a wizard.
- Hit
Next
.
Work through the prompts to choose the installer project name and location. Choose Create a setup for a Windows application
at Step 2 and in Step 3 choose the executable and other files that should be included in the MSI (hit Add..
). At the end, hit Create
.
To build the actual MSI go to Build
-> Build Solution
in the top menu, and you should see a message like the following in the Output window:
Build started...
------ Starting pre-build validation for project 'Setup1' ------
------ Pre-build validation for project 'Setup1' completed ------
------ Build started: Project: Setup1, Configuration: Debug ------
Building file 'C:\Users\zelda\Source\Repos\Setup1\Setup1\Debug\Setup1.msi'...
Packaging file 'test.exe'...
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
What's created by default is a very basic MSI, but for additional configuration like creating custom actions, adding/changing registry keys, configuring the user interface associated with the MSI, etc., see the full documentation [2]
[1] https://marketplace.visualstudio.com/items?itemName=VisualStudioClient.MicrosoftVisualStudio2017InstallerProjects
[2] https://aka.ms/vdproj-docs