2017-08-28 227 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

相關問題