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

Advertisemen

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  :)


    Advertisemen

    Disclaimer: Gambar, artikel ataupun video yang ada di web ini terkadang berasal dari berbagai sumber media lain. Hak Cipta sepenuhnya dipegang oleh sumber tersebut. Jika ada masalah terkait hal ini, Anda dapat menghubungi kami disini.

    Tidak ada komentar:

    Posting Komentar

    © Copyright 2017 Tutorial Unity 3D