本文介绍了namaspeace 中缺少 UWP 和 FullTrustProcessLauncher的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 FullTrustProcessLauncher 从 UWP 应用程序启动 powershell(一些所有用户都可以执行的轻量级命令)命令.

I am trying to launch powershell (some lightweight commands that all user can do) command from UWP application using FullTrustProcessLauncher.

问题是我发现当前上下文中不存在此名称.

Problem is I am getting that this name does not exists in current context.

我的清单基本上是默认的,所以它看起来像:

My manifest is largly default so it looks like :

<?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:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" 
  xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"

  IgnorableNamespaces="uap mp">

 <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="PrototypeProject.App">

     <Extensions>
        <desktop:Extension Category="windows.fullTrustProcess" Executable="powershell.exe">
      <desktop:FullTrustProcess>
        <desktop:ParameterGroup GroupId="TestGroup" Parameters="ls"/>
      </desktop:FullTrustProcess>
    </desktop:Extension>
  </Extensions>

   </Application>
 </Applications>

 <Capabilities>
   <Capability Name="internetClient" />

   <rescap:Capability Name="runFullTrust"/>

  </Capabilities>
</Package>

我试图调用它的类看起来像:

And class I am trying to call it from looks like:

using Windows.ApplicationModel;
using Windows.Foundation;

namespace FullTrustProcess
{
    public class Ftp
    {
        public const string FtpParamGroupId = "TestGroup";

        public void RunFtp()
        {
            IAsyncAction operation = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(FtpParamGroupId);
        }
    }
}

现在我错过了什么吗??

Now am I missing something??

推荐答案

看起来我遗漏了 - UWP 的 Windows 桌面扩展,在扩展参考中

It looks like I was missing - Windows Desktop Extensions for the UWP, in extensions reference

这篇关于namaspeace 中缺少 UWP 和 FullTrustProcessLauncher的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 05:04