问题描述
我拼命的IE浏览器在C#开发为CAB压缩包来部署一个ActiveX。我已经(从计算器其中的一些)读了很多资源,它似乎有很多人有同样的问题。我曾尝试3的解决方案:一)创建一个CAB VS项目,b)使用 CABARC
在INF一个COM注册手动创建一个CAB和c)与发射手动创建一个CAB MSIEXEC
。他们没有工作。我甚至试过四)建立该启动 MSIEXEC
无济于事(因为有些人建议干脆推出 MSIEXEC
在Vista上一个引导程序不能工作)。
I am desperately trying to deploy an ActiveX for IE developed in C# as a CAB archive. I have read many resources (some of them from StackOverflow) and it appears a lot of people are having the same problems. I have tried 3 solutions: a) creating a CAB VS project, b) manually creating a CAB using CABARC
with a COM registration in INF and c) manually creating a CAB with launching msiexec
. None of them worked. I even tried d) creating a bootstrapper which launches msiexec
to no avail (because some people suggested simply launching msiexec
on Vista can't work).
我运行Windows Vista,但我的项目未能在IE6在XP上运行,甚至
I am running Windows Vista but my project fails to run even on IE6 on XP.
当我使用MSI安装ActiveX,都是上的所有窗口的罚款。显然,CAB事情不工作,我无法找到尚未调试这整个过程之有道。
When I install ActiveX using MSI, all is fine on ALL Windows. Apparently CAB thing is not working and I could not find a proper way to debug this whole process yet.
任何帮助是AP preciated。
Any help is appreciated.
推荐答案
的更新:请注意,这个古老而优秀的答案仍然是一个非常不错的大纲如何处理解决这个问题,至少沿着进化规模如Win7和IE11。我刚刚成功使得它使用回答者的Firebreath.org工具作为起跳点的所有工作。这并不简单,但它可以做到的。我添加了一个引用,该项目下面的参考列表,因为它可为目前的开发更符合逻辑的起跳点比这个概述。的
万岁 - 我刚刚完成了一个相同的项目,所以你会很高兴地知道,它实际上是可能的。我只测试了这个在XP上 - 我的理解可能存在的问题,其中Vista / 7的不允许 MSIEXEC
被称为
Hooray - I have just finished an identical project, so you'll be pleased to know that it's actually possible. I have only tested this on XP - I understand there may be issues where Vista/7 don't allow msiexec
to be called.
,我做了以下内容:
- 强命名大会。
- 创建一个INF文件
- 创建使用Visual Studio 2008安装项目模板中的MSI。
- 使用IEX press.exe与Windows XP捆绑创建一个CAB文件。
我用看起来像* .inf文件:
The *.inf file I used looks like:
[version]
signature="$CHICAGO$"
AdvancedINF=2.0
[Setup Hooks]
install=install
[install]
run=msiexec.exe /package """%EXTRACT_DIR%\SampInst.msi""" /qn
如果您需要更改的唯一位是 SampInst.msi
。注意:我会用一个8.3文件名,长文件名可能会导致问题。测试时,我也不会要么使用qn开关,因为这是一个静默安装。
The only bit you should need to change is the SampInst.msi
. Note I would use an 8.3 filename, as long filenames can cause issues. While testing, I would not use the qn switch either, as that is a silent install.
安装程序必须做的只有一件事,那就是通过调用RegAsm上注册程序集。大多数安装程序将提供一些方法,可以轻松地做到这一点。例如,到2008年VS创建一个安装程序将只需要有设置为vsdrpCOM组件的注册属性。请注意, vsdrpCOM 应,因为它在编译时会产生相应的注册表项选择。该vsdrpCOMSelfRegistration设置是可能失败,因为它在运行时调用RegAsm,并且将因此不非管理员工作。
The installer has to do only one thing, and that is register the assembly by calling RegAsm on it. Most installers will provide some method to easily do this. For example, an installer created through VS 2008 will simply need to have the "Register" property of the assembly set to "vsdrpCOM". Note that vsdrpCOM should be chosen as it generates the appropriate registry entries at build-time. The vsdrpCOMSelfRegistration setting is likely to fail as it calls RegAsm at run-time, and will thus not work for non-administrators.
这可以通过任何驾驶室归档来完成。 Windows XP中包含IEX press.exe,向导驱动的归档,而微软的CAB SDK包含CABARC.EXE。其他第三方工具也可提供。
请注意,您将需要在CAB文件中保留空间为code-签约,如果你要签署CAB。
This can be done by any cab archiver. Windows XP contains iexpress.exe, a wizard driven archiver, while Microsoft’s CAB SDK contains cabarc.exe. Other 3rd-party tools are also available.Note that you will need to reserve space in the CAB file for code-signing if you are going to sign the CAB.
您需要将驾驶室INF文件和MSI文件。你不会需要驾驶室setup.exe文件。
You will need to CAB the INF file, and the MSI file. You will not need to CAB the Setup.Exe file.
便捷提示:VS2008安装项目的项目类型允许您设置的属性生成后步骤,这样你就可以在一个步骤建立和CAB。我生成后步骤如下:
Handy hint: The VS2008 Setup Project project type allows you to set a post-build step in the properties, so you can build and CAB in a single step. My post-build step looks like:
cd "$(ProjectDir)"
"%WINDIR%\System32\Makecab.exe" /f "VboCslib.ddf"
该DDF文件格式是。
对象标签用来指向包含安装程序的CAB文件。这将部署ActiveXControl一个非常简单的HTML页面将是:
The object tag is used to point to the cab file containing the installer. A very simple HTML page which would deploy an ActiveXControl would be:
<html>
<head></head>
<body>
<!--
ID : The id of the ActiveX control to be used in JavaScript.
CLASSID : The GUID associated with the ActiveX control.
CODEBASE: The location containing the CAB installer for the ActiveX
control. This could be a URL, or a relative path.
-->
<OBJECT ID="MyActiveXControl"
CLASSID="CLSID:FC36FAE1-48E0-4f6b-B469-E1B5A8C6D1AC"
CODEBASE="cabfiles\SampleCabFile.CAB#version=1,0,0,0">
</OBJECT>
<script>
MyActiveXControl.SomeMethod();
</script>
</body>
</html>
方便的提示
- 确保您的安装程序安装了每用户的基础上,而不是一个每个机器的基础。这将使它更容易,如果用户没有管理员权限才能安装。
- - 用于签名.cab文件步骤
- - 关于INF文件架构
- - code具有强大的强纲领名称
- - 如何:部署.NET ActiveX控件
- - 通过创建.NET的ActiveX步骤步骤
- - 通过下载CAB C#ActiveX部件文件
- - ALLUSERS属性(视窗)
- - 非联系ActiveX控件
- - 微软内阁格式
- Microsoft KB247257 – Steps for signing a .cab file
- MSDN – About INF File Architecture
- SN.EXE - Code Strong Programs with Strong Names
- Nikolkos Craft – How To: Deploy .NET ActiveX Control
- CodeProject – Create ActiveX .NET Step by Step
- CodeProject – Downloading C# ActiveX Components through CAB file
- MSDN - ALLUSERS Property (Windows)
- MSDN – Non-Admin ActiveX Controls
- MSDN – Microsoft Cabinet Format
Internet Explorer 6中实际上提供了一个非常有用的辅助诊断。清除Internet临时文件,然后导航到该网页。如果安装不能正常工作,请您的Internet临时文件,你会看到几个文件在那里。其中之一将是一个错误日志开始?codeDownloadErrorLog。将其拖动到桌面上,并在记事本打开它,它会给什么,这是试图做的时候失败的细节。
Internet Explorer 6 actually provides a really useful diagnostic aid. Clear your Temporary Internet Files, then navigate to the web-page. If the installation does not work, go to your temporary internet files and you will see a couple of files in there. One of these will be an error log starting ?CodeDownloadErrorLog. Drag it to your desktop and open it in notepad, and it will give details on what it was trying to do when it failed.
更新:具有用于生成浏览器插件为许多平台的工具集。在IE /的ActiveX code来解决这里提出的问题仅仅是一个子集。但随着2014年11月6,我发现它更容易入手Firebreath及其说明,而不是试图建立我的开发环境,并从头开始推出我自己的解决方案。
Update: Firebreath.org has a toolset for generating browser plugins for many platforms. The IE/ActiveX code to solve the problem posed here is just a subset. But as of 6 Nov 2014, I found it easier to start with Firebreath and its instructions than to try to build up my dev environment and roll all my own solutions from scratch.
这篇关于部署C#的ActiveX的Internet Explorer使用CAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!