To run the application you developed with Visual Studio on other systems, it is not enough to just compile it. The project needs to be packaged in an exportable way. In this article, we explain in detail the process of creating a setup file (MSI/EXE) for Windows Forms, WPF, or Console projects.
Which Project Types Does It Apply To?
-
.NET Framework and .NET Core/5/6/7 projects
-
Windows Forms (WinForms)
-
WPF Applications
-
Console Applications
1. Quick Packaging with the Publish Feature
With the "Publish" feature that comes with Visual Studio 2019/2022, you can easily:
-
Create an EXE file
-
Create a Setup file (installer)
-
Perform a ClickOnce installation.
➤ Steps:
-
Right-click on the project → Publish
-
Create a new profile: "Folder"
-
Specify the file location
-
Select "Target Runtime":
win-x64
orwin-x86
-
Select "Deployment Mode":
Self-contained
(works with all dependencies) -
Click the "Publish" button
The resulting EXE file can be run, and all dependencies are located in the publish
folder.
2. Creating a Setup (MSI/EXE) Package (Advanced Installer or WiX)
Method 1: Microsoft Visual Studio Installer Projects Extension
-
Download the "Installer Projects" extension from the Visual Studio Marketplace
-
Right-click on your solution > Add > New Project > Setup Project
-
Add the main project output (bin/Release/*.exe) under "Application Folder"
-
Right-click > "Build"
-
Setup.exe
andSetup.msi
files are created
Method 2: WiX Toolset (Professional Approach)
-
Install WiX Toolset (https://wixtoolset.org/)
-
Install the WiX Extension plugin for Visual Studio
-
Create a new WiX Project
-
Define file paths, GUIDs, versions, etc. with XML configuration
-
Build → .MSI is created
WiX sample configuration:
3. Easy Distribution with the ClickOnce Method
-
Offers an easy update system
-
The user installs via web or file path
➤ Setup:
-
Right-click on the project → Properties > Publish tab
-
Check "ClickOnce"
-
Publish path:
\network\path
,ftp://
,http://
,file://
-
Check dependencies in the "Application Files" section
-
Click "Publish Now"
Installation can be done with the resulting setup.exe file. Provides application update support.
Extra: Using Obfuscation to Protect Code
-
Dotfuscator
(Comes with Community Edition Visual Studio) -
ConfuserEx
(Open source)
Code protection makes it difficult to reverse engineer your packaged application with tools like .NET Reflector.
✅ Conclusion
By converting your Visual Studio projects to .EXE or .MSI files, you provide both a professional look and easy installation. While tools like WiX are preferred for advanced installation needs, Publish and ClickOnce methods are quite effective for quick solutions.