Packaging Desktop Applications in Visual Studio
Packaging is the final step in delivering Windows desktop applications to your users. This guide walks you through creating installers, configuring prerequisites, and publishing your app via ClickOnce or MSIX.
Contents
ClickOnce Deployment
ClickOnce provides a simple, web-ready deployment model that automatically checks for updates.
Project → Publish → ClickOnce
Publish Location: https://mydomain.com/app/
Installation URL: https://mydomain.com/app/install
MSIX Packaging
MSIX is the modern packaging format that supports clean installs, updates, and removal.
- Right‑click the project → Add → New Project → Windows Application Packaging Project.
- Set
PackageVersioninPackage.appxmanifest. - Configure
Dependenciesfor required frameworks.
Build the package to generate an .msix file ready for distribution.
Setup Project (WiX)
For traditional MSI installers, use the WiX Toolset.
<!-- Sample WiX snippet -->
<Product Id="*" Name="MyApp" Language="1033" Version="1.0.0.0" Manufacturer="Contoso">
<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />
<Directory Id="TargetDir" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MyApp">
<Component Id="MainExecutable" Guid="*">
<File Source="bin\Release\MyApp.exe" />
</Component>
</Directory>
</Directory>
</Directory>
</Product>
Signing the Installer
Code signing ensures authenticity and trust.
signtool sign /fd SHA256 /a /tr http://timestamp.digicert.com /td SHA256 MyApp.msix
signtool sign /fd SHA256 /a /tr http://timestamp.digicert.com /td SHA256 setup.msi
Troubleshooting
| Issue | Cause | Resolution |
|---|---|---|
| Installation fails with 0x80070005 | Insufficient permissions | Run installer as Administrator or adjust manifest to request elevation. |
| ClickOnce update not detected | Publish version unchanged | Increment the Publish Version before republishing. |
| MSIX package blocked by SmartScreen | Missing code signing certificate | Acquire a valid EV code signing certificate and sign the package. |
Did this page help you?