Google Windows 10 #UWP Apps: How to deploy .appx file with Application Deployment (WinAppDeployCmd.exe) tool, beginners tutorials (C#-XAML) | SubramanyamRaju Xamarin & Windows App Dev Tutorials

Saturday, 13 February 2016

Windows 10 #UWP Apps: How to deploy .appx file with Application Deployment (WinAppDeployCmd.exe) tool, beginners tutorials (C#-XAML)

Introduction:
In prev post i was explained about how to deploy .appx file in WinRT windows phone 8.1. During development you typically deploy and run your app from Visual Studio. Optionally in WinRT/Silverlight windows phone 8.1, you can also use the stand-alone Application Deployment tool to deploy your app to the emulator or to a registered device. But in Windows 10 Universal Windows Platform(UWP), With Windows 10 SDK Preview Build 10166, Microsoft was introduce the Windows 10 Application Deployment (WinAppDeployCmd.exe) tool. 


The Windows 10 Application Deployment (WinAppDeployCmd) is a command line utility that can be utilized to deploy a Universal Windows app from a Windows 10 PC to any Windows 10 mobile device. It allows users to deploy an .AppX to a device connected through USB or available on the same subnet without requiring access to the complete Visual Studio solution.
Requirements:
  • This article is targeted for windows 10 Universal Windows Platform(Version 1511) , so make sure you’ve downloaded and installed the latest Windows 10 SDK from here.
  • I assumes that you’re going to test your app on the Windows Phone emulator. If you want to test your app on a phone, you have to take some additional steps. For more info, see Register your Windows Phone device for development.
  • This post assumes you’re using Microsoft Visual Studio 2015 or Later.
  • This article is developed on windows 8.1 machine. So Visual Studio settings may differ from windows 10 OS VS.
Note: Windows 10 SDK works best on the Windows 10 operating system. And it is also supported on: Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2, but not all tools are supported on these operating systems.

Description:
This article can explain you about below topics
1. Why .Appx Deployment?
2. What are prerequisites to deploy .AppX file?
3. How to use Application Deployment (WinAppDeployCmd.exe) tool?

1. Why .AppX Deployment?

Often when you write a Windows Phone  application you do not want to give users the full source code. In such cases it is possible to share only the build file and deploy it to a device or emulator. You can accomplish this using the Windows Phone Application Deployment tool that comes with the RTM version of Windows Phone Developer Tools.
2. What are prerequisites to deploy .AppX file?
WinAppDeployCmd is a stand-alone tool that comes as part of the Windows 10 SDK installation. To use it we need to follow below steps.
Go into the Settings of a Windows 10 phone device and search for Update & Security category and turn on Developer Mode.


3. How to use Application Deployment (WinAppDeployCmd.exe) tool?
Before .AppX deployment, first we need to generate .AppX file from our existing project. So first create new project name is (Ex: Hello World)

If you want to add some code in xaml page, lets add below code in MainPage.xaml.


  • <Page  
  •     x:Class="Hello_World.MainPage"  
  •     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  •     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
  •     xmlns:local="using:Hello_World"  
  •     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
  •     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"  
  •     mc:Ignorable="d">  
  •   
  •     <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">  
  •         <Grid.RowDefinitions>  
  •             <RowDefinition Height="Auto"/>  
  •             <RowDefinition Height="Auto"/>  
  •         </Grid.RowDefinitions>  
  •         <!--Title-->  
  •         <TextBlock Text="Hello World" Grid.Row="0" Margin="12" FontSize="25" FontWeight="Bold"/>  
  •         <TextBlock Text="A sample for understanding Windows 10 .Appx file deployment with Application Deployment   
  •                    (WinAppDeployCmd.exe) tool" TextWrapping="Wrap" Grid.Row="1"  Margin="12"/>  
  •     </Grid>  
  • </Page>  


  • Press F5 to run project, and now its time to generate .AppX file, so please follow below steps for it.
    Step 1: Right click on your Project=>Store=>Create App Packages

    Step2: In the Create App Packages wizard, select 'No' If you want to create a local package


    Step3: The next dialog provides a choice of processor platforms to target. However, if you are using platform specific binaries in your app, you’ll need to build separate packages for each platform. 


    In this article, we selected the 'ARM' platform and now press the “Create” button. Then wizard gives us a link to where the package was created.

    So now you can get the path where .AppX has been created like below:
    Please copy above .Appx file path, which we need to use it in deployment. 

    Okay, now it's time to .AppX deployment with WinAppDeployCmd tool, which is located from the C:\Program Files (x86)\Windows Kits\10\bin\x86\ directory (based on your installation path for the SDK). So open command prompt and change directory path to this.
    We can also list all the available target devices on the network using same subnet and use respective IP Address for specific device.

    Below syntax is common possibility that you can used to install .appx with WinAppDeployCmd.exe
    • WinAppDeployCmd install -file <Appx file path> -ip <address> -pin <p>

    Here we can read list of possible syntax of WinAppDeployCmd.exe.

    Now install the our "Hello World_1.0.0.0_ARM_Debug.appx" app package to a Windows 10 phone device with an IP address of 127.0.0.1, with a PIN of A1B2C3.

    For example:
    WinAppDeployCmd install -file "D:\Windows Phone\Subbu\UWP\Hello World\Hello World\AppPackages\Hello World_1.0.0.0_ARM_Debug_Test\Hello World_1.0.0.0_ARM_Debug.appx" -ip 127.0.0.1 -pin A1B2C3

    Note: A pin if it is required to establish a connection with the target device. (You will be prompted to retry with the -pin option if authentication is required.)



    Now we can found installed app on device/emulator like below:
    One we tap on our app icon from app list, the screen could be like below:

    Important Notes:
    1. Make sure to enable developer mode for windows 10 devices, before .appx deployment. Otherwise you will get below error
    "Error : DEP0001 : Unexpected Error: To install this application you need either a Windows developer license or a sideloading-enabled system. (Exception from HRESULT: 0x80073CFF)"
    2. This sample will be work on all window 10 devices OS devices. And this sample was tested in Lumia 735 device with Windows 10 OS (version 1511).
    3. Windows 10 SDK works best on the Windows 10 operating system. And it is also supported on: Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Server 2008 R2, but not all tools are supported on these operating systems
    4. This article is developed on windows 8.1 OS with 64 bit. 

    Custom ClipBoard
    FeedBack Note:
    Please share your thoughts,what you think about this post,Is this post really helpful for you?I always welcome if you drop comments on this post and it would be impressive.

    Follow me always at  
    Have a nice day by  :)

    15 comments:

    1. Thank you very much for such a nice tutorial. symphony mobile

      ReplyDelete
    2. This comment has been removed by the author.

      ReplyDelete
    3. Hi Raj,this is hemanth and i am new to the windows app development... actually i have some doubts regarding the windows apps, and i messaged you in the Facebook but i didn't get any response so i am followed to here...!! I have a requirement, that is playing multiple sounds at a time with looping even in background also( Means even app minimized and screen locked) in windows universal development. i am successfully playing multiple sounds at a time with looping. But playing these sounds in background i didn't get correct solution. So please tell me how can i play multiple sounds in background in windows universal app development. For this requirement i am using c#, SharpDX, source-voice,XAudio2....

      This is my Question So, Please help me ASAP.


      Thanks in Adavance..!

      ReplyDelete
    4. Hi Raj,this is hemanth and i am new to the windows app development... actually i have some doubts regarding the windows apps, and i messaged you in the Facebook but i didn't get any response so i am followed to here...!! I have a requirement, that is playing multiple sounds at a time with looping even in background also( Means even app minimized and screen locked) in windows universal development. i am successfully playing multiple sounds at a time with looping. But playing these sounds in background i didn't get correct solution. So please tell me how can i play multiple sounds in background in windows universal app development. For this requirement i am using c#, SharpDX, source-voice,XAudio2....

      This is my Question So, Please help me ASAP.


      Thanks in Adavance..!

      ReplyDelete
    5. very clear, thank you so much

      ReplyDelete
    6. All contents of this blog are awesome and informative. i am a mobile app developer and this blog is very helpful for me. Good job Subbu..
      Mobile App Development Company in Jaipur

      ReplyDelete
    7. Due to innovative, fully featured, fast and easy to use mobile apps the business gets highly transformed. The increasing use of cell phones has increased the demand for mobile apps. Choose the best Mobile Application Development Company India to get the fully featured mobile apps.

      ReplyDelete
    8. I really enjoyed this posting in which you share a valuable post. Thanks for sharing it.
      Mobile App Developer

      ReplyDelete
    9. The individuals who love to play the filthy round of infection advancement frequently harm your PC close to an infection disease. This is effectively preventable by securing a standard Antivirus Software Download for your framework. https://how-to-remove.org/malware/browser-hijacker-removal/chjicha-club-removal/

      ReplyDelete
    10. you did a great job and i found many information tutuapp apk

      ReplyDelete
    11. This comment has been removed by the author.

      ReplyDelete

    Search Engine Submission - AddMe