Package a desktop app from source code using Visual Studio
You can use the Windows Application Packaging Project project in Visual Studio to generate a package for your desktop app. Then, you can publish that package to the Microsoft Store or sideload it onto one or more PCs.
The Windows Application Packaging Project project is available in the following versions of Visual Studio. For the best experience, we recommend that you use the latest release.
- Visual Studio 2019
- Visual Studio 2017 15.5 and later
The Windows Application Packaging Project project in Visual Studio is supported on Windows 10, version 1607, and later. It can only be used in projects that target Windows 10 Anniversary Update (10.0; Build 14393) or a later release.
Prepare your application
Review this guide before you begin creating a package for your application: Prepare to package a desktop application.
Create a package
In Visual Studio, open the solution that contains your desktop application project.
Add a Windows Application Packaging Project project to your solution.
You won't have to add any code to it. It's just there to generate a package for you. We'll refer to this project as the "packaging project".
Set the Target Version of this project to any version that you want, but make sure to set the Minimum Version to Windows 10 Anniversary Update.
In Solution Explorer, right-click the Applications folder under the packaging project and choose Add Reference.
Choose your desktop application project, and then choose the OK button.
You can include multiple desktop applications in your package, but only one of them can start when users choose your app tile. In the Applications node, right-click the application that you want users to start when they choose the app's tile, and then choose Set as Entry Point.
If the application you are packaging targets .NET Core 3, follow these steps to add a new build target to the project file. This is only necessary for applications that target .NET Core 3.
In Solution Explorer, right-click the packaging project node and select Edit Project File.
<Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" />element in the file.
Replace this element with the following XML.
<ItemGroup> <SDKReference Include="Microsoft.VCLibs,Version=14.0"> <TargetedSDKConfiguration Condition="'$(Configuration)'!='Debug'">Retail</TargetedSDKConfiguration> <TargetedSDKConfiguration Condition="'$(Configuration)'=='Debug'">Debug</TargetedSDKConfiguration> <TargetedSDKArchitecture>$(PlatformShortName)</TargetedSDKArchitecture> <Implicit>true</Implicit> </SDKReference> </ItemGroup> <Import Project="$(WapProjPath)\Microsoft.DesktopBridge.targets" /> <Target Name="_StompSourceProjectForWapProject" BeforeTargets="_ConvertItems"> <ItemGroup> <_TemporaryFilteredWapProjOutput Include="@(_FilteredNonWapProjProjectOutput)" /> <_FilteredNonWapProjProjectOutput Remove="@(_TemporaryFilteredWapProjOutput)" /> <_FilteredNonWapProjProjectOutput Include="@(_TemporaryFilteredWapProjOutput)"> <SourceProject> </SourceProject> </_FilteredNonWapProjProjectOutput> </ItemGroup> </Target>
Save the project file and close it.
Build the packaging project to ensure that no errors appear. If you receive errors, open Configuration Manager and ensure that your projects target the same platform.
Use the Create App Packages wizard to generate an .msixupload/.appxupload file.
You can upload that file directly to the Store.
Find answers to your questions
Give feedback or make feature suggestions
Run, debug or test your desktop application
Enhance your desktop application by adding UWP APIs
Extend your desktop application by adding UWP projects and Windows Runtime Components
Distribute your app