test windows 8 store apps on surface

Molly checking out Xbox Games on my Samsung Windows 8 Tablet

I have been getting this question more and more over the past few weeks so I figured it was easier to post here instead of copying and pasting in email over and over again.

People want to test their Windows 8 Store apps on Surface and sometimes get hung up on the details related to sideloading. If you are simply testing as a developer, you have a couple options that I detail below.

  • Remote debugging. This is accomplished with the Remote Tools. I was successfully able to connect to my Surface over my local network from my Windows 8 machine to launch and remote debug. Just set “Local Machine” to “Remote Machine” in the toolbar of VS.

OR (the next 2 generate the same result) 

  • Build in VS as you normally would and then use the “Create App Packages…” wizard in VS. This can be found in the Project… Store… menu (this will only be available if you are working on a Windows 8 Store app)
  • EASIEST: Open VS Command prompt, navigate to the project folder, and run: msbuild /p:Platform=ARM projectname(ex: msbuild /p:Platform=ARM myproject.jsproj (or csproj if working in C#)) This will automatically create the appx and needed Powershell file to install it. You only need the /p (property switch if you are targeting Any CPU in your app (which most are). Otherwise, you can go into the Solution Configuration Manager and just select ARM as the target platform and simply type msbuild name.jsproj

After you do either of the above, there will be a AppPackages directory in the VS project directory. In there will be the ARM folder with the appx and Powershell file needed to install it. Copy that ARM folder onto a USB drive to install onto Surface

INSTALLING ON SURFACE (or any other Windows 8 machine)

This is actually pretty easy, but the first time you install a sideloaded appx, you need to obtain a developer certificate for the device. You would just use your Microsoft account when prompted.

  1. Go into the folder on the USB drive and right-click the Powershell commandlet Add-AppDevPackage.ps1and select Run with Powershell
  2. It will most likely tell you that you need to run this as an Administrator and kick off a UAC prompt. Select Yes.
  3. Then it will tell you need to obtain and install a dev cert for the Surface. It will open a window where you log in with your Microsoft account
  4. The dev cert is downloaded and installed:
  5. You app then installs beautifully

Now, subsequent apps, you simply just need to right-click the Powershell script and it will install. I just installed 2 apps on my Surface that I am working on using MSBUILD.

Happy building!