0

我正在尝试设置一个AppxManifest.xml启动 Win32 应用程序作为完全信任的应用程序。使用下面的代码片段,我可以在 Visual Studio 2017 中调试应用程序Add-AppxPackage -Register AppxManifest.xmlDebug > Other Debugging Tools > Debug Installed Application

但是,我想在启动应用程序时将一些参数传递给它。我怎样才能做到这一点?我不介意在AppxManifest.xml最简单的情况下列出它们,我只需要知道如何。

...
<Applications>
    <Application Id="App" Executable="SomeExecutable.exe" EntryPoint="Windows.FullTrustApplication">
      <uap:VisualElements DisplayName="Wrap" Description="Wrap" BackgroundColor="transparent" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png">
        <uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" />
      </uap:VisualElements>
    </Application>
  </Applications>
...
4

1 回答 1

-1

协议关联是您要寻找的:

协议关联可以使其他程序和系统组件与您的打包应用程序互操作。当您的打包应用程序使用协议启动时,您可以指定要传递给其激活事件参数的特定参数,以便它可以相应地运行。仅打包的、完全信任的应用程序支持参数

<Package
  xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
  xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
  IgnorableNamespaces="uap3, desktop">
  <Applications>
    <Application>
      <Extensions>
        <uap3:Extension
          Category="windows.protocol">
          <uap3:Protocol
            Name="myapp-cmd"
            Parameters="/p " />
        </uap3:Extension>
      </Extensions>
    </Application>
  </Applications>
</Package>
于 2019-03-11T16:05:01.453 回答