使用“fullTrustProcess"创建应用程序包时出错指向可执行文件 [英] Error while creating app package with "fullTrustProcess" pointing to a executable

查看:16
本文介绍了使用“fullTrustProcess"创建应用程序包时出错指向可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试部署示例应用程序,以将 AppServices 与 UWP 应用程序连接起来.示例运行并构建得很好,但是当我尝试按照指南打包整个内容时,它给了我一个错误.

I am trying to deploy the sample application for bridging AppServices with a UWP application. The sample runs and builds just fine but when I try to follow the guide to package the whole thing it gives me an error.

链接到包装指南

此处为 AppService Bridge 示例存储库.

错误信息:

 Error Manifest validation error: Line 36, Column 64, Reason: The file name  "BackgroundProcess.exe" declared for element "*[local-name()='Applications']/*[local-name()='Application']/*[local-name()='Extensions']/*[local-name()='Extension' and @Category='windows.fullTrustProcess']" doesn't exist in the package.

我发现了产生错误的代码片段,但我还没有找到修复它的方法.

I've found the code-snippet generating the error, but I have haven't found a fix for it yet.

如果我从文件 Package.appxmanifest删除以下代码,Visual Studio 将成功构建包:

If I remove the following code from the file Package.appxmanifest, visual studio successfully builds the package:

<Extensions>
  <uap:Extension Category="windows.appService">
    <uap:AppService Name="CommunicationService" />
  </uap:Extension>
  <desktop:Extension Category="windows.fullTrustProcess" Executable="BackgroundProcess.exe" />
</Extensions>

但这显然也将消除流程的桥梁,这是本练习的重点.

But this will clearly also remove the bridging to the process which is the whole point of this exercise.

这似乎与此问题有些相关,但不同之处在于我有一个 .exe,而该问题似乎可以为 .dll 回答:

This seems to be somewhat related to this question but the difference is I have a .exe and that question seems to answer it for .dlls:

构建通用应用程序时出错对于商店:清单引用文件‘MyAppName.dll’,它不是有效负载的一部分."

(更新 UWP 工具似乎没有修复它.)

(Updating UWP Tools did not seem to fix it.)

推荐答案

我似乎让包创建工作正常.我已经非常绝望了,我尝试使用 C++ 控制台而不是 C#,如 AppServiceBridgeSample_C++ 示例.我只需要将 Win32Process_CPP.exe 文件添加到 UWP 项目中,并使用 Copy if newer 标志将其标记为 Content.之后 Create App Packages 操作成功.但是只是简单地将 C++ 控制台改回 C# 控制台又会导致失败 - 很奇怪!

I seem to get the package creation working. Being quite desperate already I tried to use C++ console instead of C#, as in AppServiceBridgeSample_C++ sample. I only had to add the Win32Process_CPP.exe file to UWP project and mark it as Content with Copy if newer flag. After that the Create App Packages operation succeeds. But just simple changing the C++ console back to a C# one resulted to failure again - quite strange!

据我所知,主要问题在 文档:

As I have found, the main problem is known and described in docs:

如果您更喜欢使用 C# 项目来打包您的应用程序,您需要了解以下已知问题:

If you prefer to use a C# project to package your app, you need to be aware of the following known issues:

存储在 UWP 项目根文件夹中的 Win32 二进制文件在 Release 中被删除.如果您不使用文件夹来存储您的 Win32二进制文件,.NET Native 编译器将从最终的包,导致清单验证错误,因为可执行文件找不到入口点.

Win32 Binaries stored in the root folder of the UWP project are removed in Release. If you don't use a folder to store your Win32 binaries, the .NET Native compiler will remove those from the final package, resulting in a manifest validation error since the executable entry point can't be found.

解决这个问题很简单:

  1. 在 UWP 项目根目录中创建一个目录(例如 win32).这是必须放置控制台二进制文件 (BackgroundProcess.exe) 的地方.

所以你得到例如c:\test\AppServiceBridgeSample\cs\UWP\win32

编辑 Package.appxmanifest 中的 desktop:Extension 元素 - 将文件夹添加到 Executable 属性值:

Edit the desktop:Extension element in Package.appxmanifest - add the folder to the Executable attribute value:

<desktop:Extension Category="windows.fullTrustProcess" Executable="win32\BackgroundProcess.exe"/>

BackgroundProcess.exe 二进制文件从新创建的文件夹添加到 UWP 项目.在其属性中,将 BuildAction 属性设置为 Content 并将 Copy to Output Directory 设置为 Copy if newer.

Add the BackgroundProcess.exe binary from the newly created folder to your UWP project. In its properties set the BuildAction attribute to Content and Copy to Output Directory to Copy if newer.

现在应该创建包.

注意:如果您使用创建的包运行 AppCertKit (WACK),您可能会因为使用 rescap 命名空间(这是仅为 Microsoft 及其合作伙伴供应商保留,请参阅 此处).由于调用了未受保护的二进制文件,BinaryAnalyzer.AppContainerCheck 也可能会失败.

Note: If you run AppCertKit (WACK) with the created package, you may get failure due to using rescap namespace (which is reserved for Microsoft and its partner vendors only, see here). The BinaryAnalyzer.AppContainerCheck will probably fail as well, due to call of unprotected binary.

这篇关于使用“fullTrustProcess"创建应用程序包时出错指向可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆