Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

How to Start an UWP App from .exe File

20.07.2018 (👁24411)

UWP Universal Windows 10 App


To make it easier to start, you can use the following link to add a Visual Studio project template as an extension

You just have to do that

https://marketplace.visualstudio.com/items?itemName=AndrewWhitechapelMSFT.CommandLine-ActivatedWindowsApp#overview 

 

Then you can create a new UWP project under Visual Studio as

New Project-> Installed-> Visual C # -> Windows Universal

: CommandLine-Activated App (Universal Windows)

 

Creates a commandline-enabled Universal Windows app. Requires Windows 10 build 16266 or later

 

In the new project under the project settings:

Minimum Version: Set Windows 10 Case Creators Update (10.0; Build 16299) or higher than Version 1803 (10.0; Build 17134)

 

The most important app extensions can be found in the Package.appxmanifest

 

For this you have to enter the uap5 in the <Package> line

..
xmlns:uap5
="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" 

IgnorableNamespaces="uap mp uap5">

 

And under the Applications block the Executable .exe and the uap5: ExecutionAlias

  <Applications>

    <Application Id="App"

      Executable="$targetnametoken$.exe"

      EntryPoint="cmd_UWP_01.App">

..

      

      <Extensions>

          <uap5:Extension 

            Category="windows.appExecutionAlias" 

            Executable="cmd_UWP_01.exe" 

            EntryPoint="cmd_UWP_01.App">

            <uap5:AppExecutionAlias>

              <uap5:ExecutionAlias Alias="cmd_UWP_01.exe" />

            </uap5:AppExecutionAlias>

          </uap5:Extension>

      </Extensions>

 

    </Application>

  </Applications>

 

 

 

Start as an Exe File from cmd-Line

Now you just have to open the command prompt with cmd and enter the .Exe directly. (without path)

C:\Users\Raimund>cmd_UWP_01.exe

 

 

 

In addition, you can now start the UWP App from the task scheduler Task Scheduler

 

Package.apx

<?xml version="1.0" encoding="utf-8"?>

 

<Package

  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"

  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"

  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"

  xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" 

  IgnorableNamespaces="uap mp uap5">

 

  <Identity

    Name="75f2892c-f88e-4e35-8ae6-c92f5013d1d0"

    Publisher="CN=Raimund"

    Version="1.0.0.0" />

 

  <mp:PhoneIdentity PhoneProductId="75f2892c-f88e-4e35-8ae6-c92f5013d1d0" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

 

  <Properties>

    <DisplayName>cmd_UWP_01</DisplayName>

    <PublisherDisplayName>Raimund</PublisherDisplayName>

    <Logo>Assets\StoreLogo.png</Logo>

  </Properties>

 

  <Dependencies>

    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />

  </Dependencies>

 

  <Resources>

    <Resource Language="x-generate"/>

  </Resources>

 

  <Applications>

    <Application Id="App"

      Executable="$targetnametoken$.exe"

      EntryPoint="cmd_UWP_01.App">

      <uap:VisualElements

        DisplayName="cmd_UWP_01"

        Square150x150Logo="Assets\Square150x150Logo.png" 

        Square44x44Logo="Assets\Square44x44Logo.png" 

        Description="cmd_UWP_01" BackgroundColor="transparent">

        <uap:DefaultTile 

          Wide310x150Logo="Assets\Wide310x150Logo.png" 

          Square310x310Logo="Assets\Square310x310Logo.png" 

          Square71x71Logo="Assets\Square71x71Logo.png">

        </uap:DefaultTile>

        <uap:SplashScreen Image="Assets\SplashScreen.png" />

      </uap:VisualElements>

      

      <Extensions>

          <uap5:Extension 

            Category="windows.appExecutionAlias" 

            Executable="cmd_UWP_01.exe" 

            EntryPoint="cmd_UWP_01.App">

            <uap5:AppExecutionAlias>

              <uap5:ExecutionAlias Alias="cmd_UWP_01.exe" />

            </uap5:AppExecutionAlias>

          </uap5:Extension>

      </Extensions>

 

    </Application>

  </Applications>

 

  <Capabilities>

    <Capability Name="internetClient" />

  </Capabilities>

</Package>

 

 

 

Main Page

<Page

    x:Class="cmd_UWP_01.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:local="using:cmd_UWP_01"

    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 Margin="16">

            <TextBlock x:Name="argumentsText" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="Wrap"/>

            <TextBlock HorizontalAlignment="Left" Margin="218,218,0,0" Text="UWP App Started from .exe File" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="44"/>

        </Grid>

    </Grid>

</Page>

 

 

 

To the project:

You have to at least the MinVersion 16299