MSDN Community – Visual Studio

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.

  1. Right‑click the project → Add → New ProjectWindows Application Packaging Project.
  2. Set PackageVersion in Package.appxmanifest.
  3. Configure Dependencies for 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

IssueCauseResolution
Installation fails with 0x80070005Insufficient permissionsRun installer as Administrator or adjust manifest to request elevation.
ClickOnce update not detectedPublish version unchangedIncrement the Publish Version before republishing.
MSIX package blocked by SmartScreenMissing code signing certificateAcquire a valid EV code signing certificate and sign the package.