UWP (Universal Windows Platform) is a powerful platform that allows for the easy development of applications that can run on various Windows 10 devices. While many developers publish their applications to the Microsoft Store for distribution, there are situations where applications need to be distributed through other means. This article will detail how to deploy UWP applications without publishing them to the Microsoft Store.
1. Setting Up the UWP Development Environment
Before starting UWP application development, you need to install Visual Studio and the Windows 10 SDK. The latest version of Visual Studio must be installed, and the UWP development workload should be selected for installation.
1. Download and install Visual Studio.
2. During installation, select "UWP Development" in the "Workloads" section.
3. The Windows 10 SDK will be installed automatically.
2. Application Development
The process of developing a UWP application is as follows.
2.1. Creating a New Project
1. Launch Visual Studio.
2. Click "Create a new project."
3. Search for "UWP" and select "Blank App."
4. Enter the project name and location, then click "Create."
2.2. Configuring the Basic UI
When you create a blank app, the basic App.xaml and MainPage.xaml files are generated. Let’s add the first UI component to the MainPage.xaml file.
<Page
x:Class="MyApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp">
<Grid>
<Button Content="Click Me" Click="Button_Click"/>
</Grid>
</Page>
In the code above, we add a button and set up an event handler to handle the click event.
2.3. Implementing the Event Handler
private void Button_Click(object sender, RoutedEventArgs e)
{
var dialog = new MessageDialog("Button was clicked!");
await dialog.ShowAsync();
}
2.4. Running and Testing the App
Press the F5 key to run the app and check if the dialog appears when the button is clicked.
3. Methods for Deploying UWP Applications
There are various ways to deploy UWP applications without publishing them to the Microsoft Store. The most common methods are to create an App Package for use or to use sideloading.
3.1. Creating an App Package
1. Click the "Build" menu in Visual Studio.
2. Select "Build Solution" to build the application.
3. Choose "File" menu -> "Publish" -> "Create App Package."
4. Follow the package creation wizard to enter the required information, and ultimately create the package.
The generated App Package will be provided in the form of .appx or .msix files. You can use this file to install on other devices.
3.2. Installation via Sideloading
Sideloading is a method of installing UWP apps without going through the Microsoft Store. To do this, developer mode must be enabled.
1. Open Windows Settings.
2. Go to "Update & Security" > "For developers."
3. Enable "Developer mode."
Now the sideloading setup is complete. To install the generated App Package, run the following command using PowerShell.
Add-AppxPackage -Path "C:\path\to\yourpackage.appx"
3.3. Deployment Using PowerShell
You can deploy the UWP app to selected devices using PowerShell. Run PowerShell as an administrator with the appropriate permissions and use the following command.
Invoke-Command -ComputerName "TargetPC" -ScriptBlock {
Add-AppxPackage -Path "C:\path\to\yourpackage.appx"
}
4. Packaging and Signing
To safely distribute UWP apps, these App Packages require a digital signature. Additional security can be enhanced with signed apps. To sign, you need to create a certificate and use it to sign the package.
1. Use MakeCert.exe to create a certificate.
2. Use SignTool.exe to sign the package.
5. Conclusion
We have explored how to deploy UWP applications without publishing them to the Microsoft Store. You can deploy them by creating App Packages and using sideloading, and can implement it across multiple devices using PowerShell. Choose the appropriate deployment method that fits each business environment and need to utilize UWP applications more effectively.
6. Additional Resources
Such deployment methods can be utilized in various ways depending on the development environment or business needs. As part of an in-depth process of UWP development, we encourage you to apply it effectively to your projects.