Running an EXE from C# using UWP

♀尐吖头ヾ 提交于 2019-11-28 21:38:46

I've been banging my head against a brick wall all night over this, but after hundreds of pages online I may have come up with a solution to my problem.

By referencing the "Windows Desktop Extensions For The UWP v10.0.14393.0" under "References > Universal Windows > Extensions" I can use:

await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

The LaunchFullTrustProcess allows me to launch a trusted application from within my own application. I then modified the Package Manifest XML file and added the following under "capabilities"

<rescap:Capability
  xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  Name="runFullTrust" />

I then added the following to "applications" in the XML

<Extensions
  xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10">
    <desktop:Extension
      Category="windows.fullTrustProcess"
      Executable="fpcalc.exe" />
</Extensions>

Then I modified the dependencies to make my application run on Windows Desktop machines

<Dependencies>
    <TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
</Dependencies>

I was then able to launch the application. Once I finish writing the code I will test it and post the correct solution to the issue for future reference.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!