2017-08-28 67 views

回答

3
+0

非常感谢您的帮助,你的榜样是很很有帮助。 – GIANGPZO

2

最后,我可以在我的UWP应用程序中启动我的.exe文件。我将逐步描述我的解决方法:
1.创建您的可执行文件(例如控制台应用程序)
2.将.exe文件复制到您的UWP应用程序启动文件夹(例如:Assets文件夹)
3.在UWP App Solution Explorer中,在“参考>通用Windows>扩展”下添加对“Windows桌面扩展UWP v10.0.14393.0”(或更高版本)的引用。
4.在UWP App Solution Explorer中,打开Package.appxmanifest xml文件(右键单击Package.appxmanifest文件 - >查看代码)。这些命名空间

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

添加到标签。然后,添加此扩展:

<Extensions> 
    <desktop:Extension Category="windows.fullTrustProcess" Executable="Assets\YourExecutableFileName.exe" /> 
</Extensions> 

应用标签。然后,添加以下代码:

<rescap:Capability Name="runFullTrust" /> 

到您的能力标签。这一步的意思是:与编译器交谈,以便知道它信任您的.exe文件的Assets \ YourExecutableFileName.exe位置。
5.在UWP应用程序时,你要启动的.exe文件,你需要执行以下代码:

await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(); 

参考:Great answer

相关问题