使用帮助库管理器和 WiX 安装帮助

发布于 2024-10-10 17:35:17 字数 3830 浏览 7 评论 0原文

我正在尝试使用 WiX 运行 Sandcastle 帮助文件生成器在构建我的 Sandcastle 项目后创建的 HelpLibraryManagerLauncher,将我自己的帮助文件添加到 Visual Studio 2010 的帮助库中。

我正在使用 WiX 的 QuietExec 自定义操作来运行以下命令:

HelpLibraryManagerLauncher.exe
  /product "VS"
  /version "100"
  /locale en-us 
  /silent 
  /brandingPackage Dev10.mshc 
  /sourceMedia MyClassLibraryHelp.msha

但是,MSI 安装程序失败并显示以下内容:

Action 00:00:00: InstallVS2010Help.
CAQuietExec:  Help Library Manager Launcher, version 1.0.0.0
CAQuietExec:  Copyright c 2010, Eric Woodruff, All Rights Reserved
CAQuietExec:  E-Mail: [email protected]
CAQuietExec:  
CAQuietExec:  Running Help Library Manager to perform the requested action.  Please wait...
CAQuietExec:  
CAQuietExec:  ERROR: The requested operation could not be performed.
CAQuietExec:  Details: The Help Library Manager returned the exit code 401: The installation of content failed.  Detailed information can be found in the event log and in the installation log.
CAQuietExec:  Error 0x80070191: Command line returned an error.
CAQuietExec:  Error 0x80070191: CAQuietExec Failed
CustomAction InstallVS2010Help returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

检查事件日志,记录以下错误:

An error occurred while updating local content: Microsoft.Help.CacheLib.CacheLibUnsignedInstallRefusedException: Exception of type 'Microsoft.Help.CacheLib.CacheLibUnsignedInstallRefusedException' was thrown.
 at Microsoft.Help.CacheLib.DocumentationCache.VerifyAndExtractPackages(VendorName vendorName, ChangeDescription change, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
 at Microsoft.Help.CacheLib.DocumentationCache.IntegrateChange(VendorName vendorName, ChangeDescription change, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
 at Microsoft.Help.CacheLib.DocumentationCache.Update(VendorName vendorName, Boolean checkForOnlineUpdates, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
 at Microsoft.Help.CacheLib.CacheManager.<>c__DisplayClass24.<UpdateAsync>b__23()
 at Microsoft.Help.CacheLib.AsyncOperationRunner.Run(Object state)

这是我的 WiX 代码:

<CustomAction Id="InstallVS2010Help" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" />
<CustomAction Id="SetPropertiesForInstallVS2010Help"
              Property="InstallVS2010Help"
              Value="&quot;HelpLibraryManagerLauncher.exe&quot; /product &quot;VS&quot; /version &quot;100&quot; /locale en-us /silent /brandingPackage Dev10.mshc /sourceMedia MyClassLibraryHelp.msha"
              Execute="immediate" />
.
.
.
<InstallExecuteSequence>
  <Custom Action="SetPropertiesForInstallVS2010Help" Before="InstallInitialize">NOT INSTALLED</Custom>
  <Custom Action="InstallVS2010Help" Before="InstallFinalize">(NOT INSTALLED) AND (NOT UPGRADINGPRODUCTCODE) AND (NOT REMOVE="ALL")</Custom>
<InstallExecuteSequence>

如果我运行 HelpLibraryManagerLauncher 从命令提示符处,它表示操作已成功完成但是当我检查帮助库时,我的帮助库尚未安装。

但是,如果我删除 /silent 开关,则会弹出通常的“帮助库管理器”窗口并列出我的帮助库。

显然,我希望能够从 WiX 自动安装帮助文件,而无需与帮助库管理器的 GUI 交互,但我一定错过了一些东西。是否无法通过命令提示符或 WiX 静默安装帮助文件? (不过,通过命令提示符静默卸载效果很好)。

CacheLibUnsignedInstallRefusedException 也是一个问题。即使帮助文件未签名,如何让 WiX(和我的 MSI)安装它?

我使用的是 WiX v3.5.2415、Sandcastle v2.610621.1 和 Sandcastle Help File Builder v1.9.1.0。 Sandcastle 帮助文件生成器使用的 Help 2.0 编译器和 HTML Help Workshop hhc 可执行文件来自 Visual Studio 2008 SDK。

任何帮助将不胜感激。

I am trying to add my own help file to Visual Studio 2010's Help Library by using WiX to run the HelpLibraryManagerLauncher that the Sandcastle Help File Builder creates after it builds my Sandcastle project.

I am using WiX's QuietExec custom action to run the following command:

HelpLibraryManagerLauncher.exe
  /product "VS"
  /version "100"
  /locale en-us 
  /silent 
  /brandingPackage Dev10.mshc 
  /sourceMedia MyClassLibraryHelp.msha

However, the MSI installer fails with the following:

Action 00:00:00: InstallVS2010Help.
CAQuietExec:  Help Library Manager Launcher, version 1.0.0.0
CAQuietExec:  Copyright c 2010, Eric Woodruff, All Rights Reserved
CAQuietExec:  E-Mail: [email protected]
CAQuietExec:  
CAQuietExec:  Running Help Library Manager to perform the requested action.  Please wait...
CAQuietExec:  
CAQuietExec:  ERROR: The requested operation could not be performed.
CAQuietExec:  Details: The Help Library Manager returned the exit code 401: The installation of content failed.  Detailed information can be found in the event log and in the installation log.
CAQuietExec:  Error 0x80070191: Command line returned an error.
CAQuietExec:  Error 0x80070191: CAQuietExec Failed
CustomAction InstallVS2010Help returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

Checking the EventLog, the following error is recorded:

An error occurred while updating local content: Microsoft.Help.CacheLib.CacheLibUnsignedInstallRefusedException: Exception of type 'Microsoft.Help.CacheLib.CacheLibUnsignedInstallRefusedException' was thrown.
 at Microsoft.Help.CacheLib.DocumentationCache.VerifyAndExtractPackages(VendorName vendorName, ChangeDescription change, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
 at Microsoft.Help.CacheLib.DocumentationCache.IntegrateChange(VendorName vendorName, ChangeDescription change, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
 at Microsoft.Help.CacheLib.DocumentationCache.Update(VendorName vendorName, Boolean checkForOnlineUpdates, StatusCallback`1 statusCallback, CertificateCheckCallback certCheckCallback)
 at Microsoft.Help.CacheLib.CacheManager.<>c__DisplayClass24.<UpdateAsync>b__23()
 at Microsoft.Help.CacheLib.AsyncOperationRunner.Run(Object state)

Here is my WiX code:

<CustomAction Id="InstallVS2010Help" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="deferred" Return="check" />
<CustomAction Id="SetPropertiesForInstallVS2010Help"
              Property="InstallVS2010Help"
              Value=""HelpLibraryManagerLauncher.exe" /product "VS" /version "100" /locale en-us /silent /brandingPackage Dev10.mshc /sourceMedia MyClassLibraryHelp.msha"
              Execute="immediate" />
.
.
.
<InstallExecuteSequence>
  <Custom Action="SetPropertiesForInstallVS2010Help" Before="InstallInitialize">NOT INSTALLED</Custom>
  <Custom Action="InstallVS2010Help" Before="InstallFinalize">(NOT INSTALLED) AND (NOT UPGRADINGPRODUCTCODE) AND (NOT REMOVE="ALL")</Custom>
<InstallExecuteSequence>

If I run the HelpLibraryManagerLauncher from a command prompt, it says that the operation completed successfully but when I check the Help Library, my help library isn't installed.

If I remove the /silent switch however, the usual Help Library Manager window pops up and my help library is listed.

Obviously, I want to be able to automatically install my help file from WiX without having to interact with the Help Library Manager's GUI, but I must be missing something. Is it not possible to silently install a help file, either through the command prompt or through WiX? (Uninstalling silently through the command prompt works just fine, though).

The CacheLibUnsignedInstallRefusedException is also a concern. How do I get WiX (and my MSI) to install my help file even though it isn't signed?

I am using WiX v3.5.2415, Sandcastle v2.610621.1, and Sandcastle Help File Builder v1.9.1.0. The Help 2.0 Compiler and HTML Help Workshop hhc executable that Sandcastle Help File Builder uses are from the Visual Studio 2008 SDK.

Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦醒时光 2024-10-17 17:35:17

HelpLibManager.exe 允许静默安装帮助集合。但是,要求之一是帮助集合必须包含在签名的 cab 文件中。这意味着您无法使用 .mshc 文件进行静默安装。

您需要做的第一件事是获取代码签名证书。如果您还没有,您可以从 VeriSign 购买一份。

拥有代码签名证书后,您需要将 mshc 文件转换为 cab 文件。您可以在命令行上使用 makecab 命令来实现此目的。

makecab myhelp.mshc myhelp.cab

然后,您需要使用代码签名证书对 cab 文件进行数字签名。您可以通过在命令行上使用signtool 命令来实现此目的。

signtool sign /f your-purchased-signing-certificate.pfx /p password /d "My Help Collection" myhelp.cab

.cab 文件经过签名后,即可在静默帮助安装中使用它来代替 .mshc 文件。请务必更新您的 msha 文件以指向 .cab 文件而不是 .mshc 文件。

/brandingPackage 开关不是必需的。我还建议将 /content 开关添加到您的自定义操作中,

/content "[CommonAppDataFolder]Microsoft\HelpLibrary"

因为如果用户尚未为本地帮助集合设置默认存储,静默帮助安装将会失败。如果用户已经设置了默认商店,则此开关将被忽略,因此始终使用它没有什么害处。

编辑:

这是我用于静默帮助安装的wix代码。请注意,我使用的是所有文件的完整路径。

首先,设置一个包含 HelpLibManager 路径的属性。

<SetProperty Id="HELPLIBMANAGER"
             Value="[ProgramFilesFolder]Microsoft Help Viewer\v1.0\HelpLibManager.exe"
             After="InstallInitialize"/>

接下来,声明将使用我们刚刚设置的 HELPLIBMANAGER 属性的自定义操作。请注意 ExeCommand 中使用单引号 ('),以便我们可以使用双引号 (") 括住文件路径。

<CustomAction Id="InstallHelp"
              Directory="YourHelpDir"
              ExeCommand='"[HELPLIBMANAGER]" /product VS /version 100 /locale en-us /silent /content "[CommonAppDataFolder]Microsoft\HelpLibrary" /sourceMedia "[#filekey.msha]"'
              Execute="deferred"/>
<CustomAction Id="RollbackInstallHelp"
              Directory="YourHelpDir"
              ExeCommand='"[HELPLIBMANAGER]" /product VS /version 100 /locale en-us /silent /uninstall /vendor "YourVendorName" /productName "YourProductName" /mediaBookList "YourMediaBookList"'
              Execute="rollback"/>

最后,安排自定义操作:

<Custom Action="RollbackInstallHelp" After="InstallFiles">NOT REMOVE="ALL"</Custom>
<Custom Action="InstallHelp" After="RollbackInstallHelp>NOT REMOVE="ALL"</Custom>

卸载操作几乎相同,并且应该相当容易计算另请注意,这仅适用于 32 位操作系统,如果您还想支持 64 位操作系统,那么您将需要更多自定义操作来设置 HelpLibManager 的正确路径,因为路径是。 32 位和 64 位操作系统之间有所不同。

HelpLibManager.exe does allow silent installation of help collections. However, one of the requirements is that the help collection must be contained in a signed cab file. This means that you cannot use the .mshc file for silent installation.

First thing you need to do is acquire a Code Signing Certificate. If you don't already have one, you can purchase one from VeriSign.

Once you have a code signing certificate, you need to convert your mshc file into a cab file. You can achieve this using the makecab command on the command line.

makecab myhelp.mshc myhelp.cab

Then you need to use your code signing certificate to digitally sign the cab file. You can achieve this by using the signtool command on the command line.

signtool sign /f your-purchased-signing-certificate.pfx /p password /d "My Help Collection" myhelp.cab

Once your .cab file is signed, it can be used in a silent help installation instead of the .mshc file. Be sure to update your msha file to point to the .cab file instead of the .mshc file.

The /brandingPackage switch is not necessary. I also suggest adding the /content switch to your custom action

/content "[CommonAppDataFolder]Microsoft\HelpLibrary"

because a silent help installation will fail if the user has not yet set up the default store for local help collections. This switch gets ignored if the user has already set up his default store, so there is no harm in always using it.

Edit:

This is the wix code I'm using for silent help installations. Note that I'm using full paths to all files.

First, set a property with the path to HelpLibManager.

<SetProperty Id="HELPLIBMANAGER"
             Value="[ProgramFilesFolder]Microsoft Help Viewer\v1.0\HelpLibManager.exe"
             After="InstallInitialize"/>

Next, declare the custom actions that will use the HELPLIBMANAGER property we just set. Note the use of single quotes (') in the ExeCommand so that we can use double quotes (") to surround the file paths.

<CustomAction Id="InstallHelp"
              Directory="YourHelpDir"
              ExeCommand='"[HELPLIBMANAGER]" /product VS /version 100 /locale en-us /silent /content "[CommonAppDataFolder]Microsoft\HelpLibrary" /sourceMedia "[#filekey.msha]"'
              Execute="deferred"/>
<CustomAction Id="RollbackInstallHelp"
              Directory="YourHelpDir"
              ExeCommand='"[HELPLIBMANAGER]" /product VS /version 100 /locale en-us /silent /uninstall /vendor "YourVendorName" /productName "YourProductName" /mediaBookList "YourMediaBookList"'
              Execute="rollback"/>

Finally, schedule the custom actions:

<Custom Action="RollbackInstallHelp" After="InstallFiles">NOT REMOVE="ALL"</Custom>
<Custom Action="InstallHelp" After="RollbackInstallHelp>NOT REMOVE="ALL"</Custom>

The uninstall actions are pretty much the same and should be fairly easy to figure out. Also be aware that this only works for a 32-bit OS. If you want to also support 64-bit OS, then you're going to need a couple more custom actions to set the correct path to HelpLibManager because the paths are different between 32 and 64 bit OS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文