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

UWP Apps als .exe im Fileexplorer oder cmd Shell Fenster oder Aufgabenplaner starten

20.07.2018 (👁10416)

Zum Einfacheren Beginn kann man unter dem folgenden Link eine Visual Studio Projekt-Vorlage als Erweiterung einbauen

Hierzu muss man nur das

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

Danach kann man unter Visual Studio ein neues UWP Projekt erstellen als

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

: CommandLine-Activated App (Universal Windows)

 

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

Im neuen Projekt unter den Projekt-Einstellungen:

Minimum Version : Windows 10 Fall Creators Update (10.0; Build 16299) oder höhger wie Version 1803 (10.0; Build 17134) einstellen

Die wichtigsten App-Erweitungen findet man in der Package.appxmanifest

Hierzu muss man die uap5 in die <Package> Zeile eintragen

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

IgnorableNamespaces="uap mp uap5">

Und unter dem Applications-Block die Executable .exe und die 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>

Starten als Exe File von cmd-Line

Jetzt muss man nur noch mit cmd die Eingabeaufforderung öffnen und die .Exe direkt eingeben.. (ohne Pfad)

C:\Users\Raimund>cmd_UWP_01.exe

 

Zusätzlich kann man nun auch die UWP App starten aus dem Aufgabenplaner 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>

Mainpage

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

Zum Projekt:

Man muss mindestens die MinVersion 16299