How Do I Deploy a Windows 8 App to Another Device for Testing?

If your developing a new Windows 8 app and you want to test it on another device (e.g. Surface), you’ll need to use a technique called sideloading. This can easily be done through a few steps that I’ll describe in this post.

What is Sideloading?

Windows 8 Store Apps are deployed through the Windows Store.  This may seem like an obvious statement. However, by default, only Windows Store apps are permitted to install and run on Windows 8. When you install an app from the Windows Store, a Windows Store signed app package is downloaded and installed on your machine. Since only Windows Store signed apps are permitted to be executed on Windows 8, it greatly reduces the introduction of malware. For development and enterprise scenarios, you can use a technique called sideloading to install and run apps that are not Windows Store signed. I’ll cover development sideloading in this post. If you are interested in how to use sideloading for line of business apps in an enterprise, please see this post.

Development Sideloading

Development sideloading is used by Visual Studio to deploy, debug and test your app.

The general requirements for sideloading are:

  1. Your appx package needs to be signed.
  2. The certificate used for signing needs to be trusted.
  3. A policy (or registry key) needs to be set to allow trusted apps to run.

On a development machine, these requirements are automatically met for you by Visual Studio. Visual Studio provides a self-signing test certificate that is used to sign the package. Also, when Visual Studio is installed, a registry key is set to allow trusted apps to run. Therefore, when you debug a Windows 8 Store app using Visual Studio, the app is test certificate signed, deployed, and allowed to run.

How do I Sideload My App on Another PC or ARM Device?

In order to deploy an app, you need an App Package. Visual Studio has functionality to create an App Package you can use to deploy your app to another machine. The following steps are how to create a local App Package.

  1. In Visual Studio Express 2012, choose “Create App Package” in the Store menu.
    image 
    Note: In Visual Studio 2012 Ultimate, the Store menu is in a different location. In the “Project” menu, use the “Store” option .
  2. In the Create App Package wizard, you will want to create a local package. Therefore, answer “No” to the “Do you want to build a package to upload to the Windows Store”. Notice the information text indicates this is the option for sideloading.
    image
  3. The next dialog provides a choice of processor platforms to target. In most cases, you would want to choose “Any CPU”. This will allow you to target all of the processor platforms and architectures. However, if you are using platform specific binaries in your app, you’ll need to build separate packages for each platform.
    image
  4. In my example, I’ll just leave the default “Any CPU” and click “Create”
    image
    Note the wizard gives us a link to where the package was created.

 

If we click the link, here is an example of what was created:

image

Here is a quick summary of the relevant files in the package directory:

Appx package (MyApp_1.0.0.0_AnyCPU_Debug.appx)

The appx package is a zip file of all of the program files for your app. This file gets deployed and installed into Windows. Try renaming the extension to “.zip” and open the zip file to see what is inside. Don’t forget to change it back before you try and deploy it.

Developer test certificate (MyApp_1.0.0.0_AnyCPU_Debug.cer)

This is your development certificate. This is the certificate that was used to sign the appx package.

PowerShell script (Add-AppDevPackage.ps1)

This PowerShell script can be used to install the development certificate and install the App.

 

Installing the App on the Target Machine

Everything you need to deploy the app is included in the package directory created by Visual Studio. I usually copy the directory to a USB memory stick to transfer the app to the target machine. On the target machine, you just need to run the PowerShell script (Add-AppDevPackage.ps1) to deploy the app. You can do this easily by right clicking on the script and selecting “Run with PowerShell”.

image

The first action performed by the script is to install the certificate. It needs to run elevated in order to perform this step. If PowerShell isn’t running elevated, the script will prompt to start an elevated process to install the certificate.

image

You will be warned and prompted to allow the certificate to be installed.

image

Once the certificate is installed, the app package is installed.

image

 Your app should now be installed on the target machine. You should be able to find the tile on the Start screen (usually at the end of the list):

image

The final requirement is to allow trusted apps to run. If your target machine has Visual Studio installed, this requirement will already be met. However, if you don’t have Visual Studio installed, you can meet the requirement through group policy or setting a registry key.  For development purposes, it’s usually easiest to set the registry key.

  • Use RegEdit to navigate to the key: HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Appx
  • Set AllowAllTrustedApps (REG_DWORD) to the value of 1

Your app should now run on the target machine.

One final note… This is the process for development sideloading. There is a more formal process for enterprise sideloading.  If you are interested in enterprise sideloading, please start with this post.

15 thoughts on “How Do I Deploy a Windows 8 App to Another Device for Testing?

  1. Ultimately, it boils down to this. You can only deploy a completed Modern UI application in 1 of 3 ways:

    1. Deploy through Microsoft Store

    2. Deploy through Microsoft System Center

    3. Deploy using special Microsoft Product Key (only available to ISVs)

    You cannot directly deploy a Modern UI application to your machines. This fact is an ultimate show stopper for us and our business partners.

  2. Daniel,

    Windows Store Apps can be sideloaded as long as you meet the 3 requirements – signed, trusted, and group policy as mentioned in the post.  There are some volume licensing requirements for Win 8 Pro and Windows RT as well. You can use all the traditional deployment techniques such as loading on an image or use a deployment tool like System Center. Check out this article for more information technet.microsoft.com/…/hh852635.aspx. You are not forced to use System Center. Basically, you need to need to install the your signed appx package on the client. See technet.microsoft.com/…/hh856045.aspx for a list of commands to install appx packages. It generally makes sense to use enterprise deployment tools such as DISM or System Center to do this (as with traditional desktop apps).

    Pat

  3. Pat, Thanks for the response. Those articles confirm my findings. By not using the Microsoft Store, target devices must be enabled for sideloading. Sideloading can only be enabled in an enterprise by using a sideloading product activation key (3) or through System Center (2).

    Consider the following scenario:

    I'm a consultant that writes software for a small local company whose new Windows 8 computers do not have internet access but are locally networked. He has not invested in any server technology and only shares files between the machines. My customer would like to take advantage of the new Modern UI after having purchased touch enabled monitors and considers the clean design important for his business going forward.

    My question is this: How can I satisfy my customer's requirements?

    Perhaps you could write another article that outlines the solution for that scenario? Does a solution exist that uses click-once deployment (of Modern UI applications)?

    Thanks for your time,

    Daniel

  4. Daniel,

    From an app integrity standpoint, apps should be certified, signed, distributed, and maintained from the Windows Store. This is the preferred option. Sideloading is a solution for enterprise line of business apps and is intentionally restrictive. The general recommendation for your scenario would be to use the Windows Store to distribute your app. Unfortunately, your client has restrictions that make that difficult. There are always trade offs between goals such as reliability, integrity, security, and maintainability versus functionality.

    Pat

  5. Hi, thanks for your nice tutorial. I have a question: If i use Sideloading to deploy my app to other device. Do i need renew developer license after one month use like in visual studio develop enviroment?

  6. Regarding <<On the target machine, you just need to run the PowerShell script (Add-AppDevPackage.ps1) to deploy the app.>> Is this done from inside VS or in the plain File Explorer and is having VS installed on the target macine required. Asking as I get  <<On the target machine, you just need to run the PowerShell script (Add-AppDevPackage.ps1) to deploy the app.>> running the script from the File Explorer and not having VS installed.

  7. So in other words, Microsoft has intentionally restricted us, developers, from using this platform.

    That explains  empty Windows Store and sales numbers.

    I am being forced by Microsoft to go somewhere else in order to satisfy my customers requirements.

  8. Does not seem to work with VS2012, and deploying to W81. Machines.  

    Using the above Method of deploying via PowerShell simply results in Splash Screen then crashes. On both debug, Release Builds, on attempting to check package Install on both the Local Development W81. Pro and on remote W8.1 RT machines. Package installs but Apps do not run.

    So this sideloading method cannot be relied upon. Sorry but this is just my experience.

  9. Hi , i am doing the same but using vs2013 and app is for windows 8.1 . i am doing this first time so dont have knowledge at deep . what problem i am facing is that my created apppackage file is not having DB so it is crashing when i am going to use the page which have DB connectivity .

    while doing development i was using local folder for keeping Database File . Now i need to create the Build for that and its creating build but the created app or Package is not having database or it may not supporting that .

    how i can resolved that any idea ??  

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.