Csharp/C#教程:使用ClickOnce应用程序部署COM组件分享


使用ClickOnce应用程序部署COM组件

我们正在开发一个需要屏幕“录制”的C#WPF(.Net 4.0)应用程序。 我们已经评估了ByteScout的Screen Capture SDK (免费试用版),它完全符合我们的需求。

但是,问题是我们的应用程序旨在由ClickOnce部署到我们客户的计算机(不在我们的网络上),并且可能以有限的非管理用户身份登录。 SDK具有可再发行组件,但这需要单独安装 – 对ClickOnce没有好处。

ByteScout似乎在其文档中的“免注册部署”部分中解决了这一需求:

/* * REGISTRRATION FREE SCENARIO DEPLOYMENT: allows to just copy DLLs from the SDK without installing them * See SAMPLE.EXE.manfest as the sample. * 1) Rename "SAMPLE.EXE.manifest" into the actual application name (eg "MyApp.exe.manifest") * 2) Edit this .manifest file and replace "SAMPLE.EXE" with your application name (eg "MyApp.exe") * 3) Copy put this .manifest file into the same folder where your MyApp.exe is located * 4) Copy all dlls from /x86/ folder into the same folder as your application * So you will have files in the folder: * - MyApp.exe * - MyApp.exe.manifest * - BytescoutVideoMixerFilter.dll * - BytescoutScreenCapturingFilter.dll * - BytescoutScreenCapturing.dll * 5) Now you should be able run MyApp.exe without Screen Capturing SDK installed 

所以:我创建了一个app.manifest文件 – 我的项目之前没有或者需要一个 – 并在上面提到的SAMPLE.EXE.manifest中添加了以下内容:

                 

所以我的应用程序现在有:

该项目构建良好,但当我现在运行它时,应用程序崩溃。 查看事件查看器,我看到错误:

 Activation context generation failed for "myapp.exe.Manifest". Error in manifest or policy file "myapp.exe.Manifest" on line 89. The value "" of attribute "resourceid" in element "typelib" is invalid. 

Bytescout也有一个示例控制台应用程序,我遇到了同样的问题:项目构建正常,但它失败并出现上述错误。 我尝试过他们的支持,但除了“尝试阅读文档”之外,我没有得到太多回应。

我试过“自我注册”COM组件; 我没有太多(或实际上,任何)使用COM的经验,但我尝试过的所有示例代码似乎都没有(A)工作,(B)没有管理员权限或(C)两者都工作。 我不确定它是否可以在我的场景中起作用。

有人可以建议如何继续吗? 我们所需要的只是“注册”并可在我的代码中使用的DLL,而无需安装它们。

编辑:如果我编辑生成的myapp.exe.Manifest文件,并将“resourceID”设置为“1”,我得到一个进一步的错误:

 Activation context generation failed for "myapp.exe.Manifest". Error in manifest or policy file "myapp.exe.Manifest" on line 103. The value "" of attribute "tlbid" in element "comClass" is invalid. 

如果我从项目中删除app.manifest文件,并将引用DLL上的Isolated设置设置为True ,则启动时的错误将更改为:

上述就是C#学习教程:使用ClickOnce应用程序部署COM组件分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

 Activation context generation failed for "myapp.exe.Manifest". Dll redirector contributor unable to add file map entry for file BytescoutScreenCapturing.dll; Two or more components referenced directly or indirectly by the application manifest have files by the same name. 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/954213.html

(0)
上一篇 2021年11月20日
下一篇 2021年11月20日

精彩推荐