c# - 如何在 uwp 项目中启动 exe 文件?
问题描述
我正在为 cli 程序在 uwp 中创建 gui 应用程序。我想在 uwp 项目中运行 exe 文件,但我发现 Start.Process 在 uwp 中是不可能的。我做了一些研究,认为这是最好的答案:How to launch .exe file in uwp app using fulltrustlauncher? .
我按照说明进行操作,一切似乎都很好(除了一个<rescap:Capability Name="runFullTrust" />
片段警告,但那是一个很长的警告,所以我会在最后粘贴)。我试图编译它并且它工作(!),但是当我点击一个按钮时,它应该触发事件:
private async void Run_Click(object sender, RoutedEventArgs e)
{
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}
我收到一个错误:
目标进程退出而没有引发 CoreCLR 启动事件。确保目标进程配置为使用 .NET Core。如果目标进程未在 .NET Core 上运行,则可能会出现这种情况。
有什么解决办法吗?
我提到的那个警告:
严重性代码说明项目文件行抑制状态警告命名空间“http*://schemas.microsoft.com/appx/manifest/foundation/windows10”中的元素“能力”在命名空间“http *:/”中具有无效的子元素“能力” /schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities'。预期的可能元素列表:命名空间“http*://schemas.microsoft.com/appx/manifest/foundation/windows10”中的“CapabilityChoice”以及命名空间“http*://schemas.microsoft.com”中的“Capability” /appx/manifest/uap/windows10' 以及命名空间'http*://schemas.microsoft.com/appx/manifest/foundation/windows10' 中的'Capability' 以及命名空间'http*:/ 中的'Capability' /schemas.microsoft。
我在 https 后面加了“*”,因为我不能添加超过 8 个链接。
解决方案
推荐阅读
- reference - 如何在库 (WixLib) 中定义 HarvestDirectory 元素,以便与该库关联的 Wix 项目不需要实现它?
- java - Java 记录和每个文件的单个类限制
- visual-studio-code - 寻找类似VS Code Remote SSH Extension的PyCharm Remote Dev体验
- python - 计算每类的词频
- javascript - Select2 下拉搜索正在消失/未找到结果
- reactjs - 反应迭代 json api 到 setState 变量
- python - 附加维度 numpy 数组
- php - 在 Laminas API 工具中使用 Zend Framework 1 库 - 自动加载供应商前缀类
- windows - 检查添加到 ssh 代理的密钥
- scroll - 如何在 Emacs 中平滑滚动?