我正在为我的应用程序创建一个CLickOnce安装程序,它依赖于另一个应用程序来运行。我希望安装程序在安装我自己的应用程序之前安装其他应用程序(如果尚未安装)。
为实现这一目标,我已按照these (MSDN)说明创建了自定义先决条件。截至目前,安装程序将安装其他应用程序,然后安装我的应用程序,但它不会检查是否已安装其他应用程序。
根据其他先决条件的示例,我在先决条件清单中创建了一个安装检查,以检查包含应用程序版本的注册表项的值。问题是注册表检查始终无法读取注册表。我已经尝试了许多其他注册表项,但无法读取它们。工作正常的是:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\SharedManagementObjects\CurrentVersion - Version
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer - Version
以及默认Bootstrapper软件包使用的其他密钥(DotNetFX40,SqlExpress2012等)。
这里发生了什么?为什么安装程序无法读取大多数注册表项?
我的product.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Product
xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
ProductCode="TestAppSetup"
/>
和我的package.xml
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" Name="Test" Culture="Culture">
<!-- Defines list of files to be copied on build -->
<PackageFiles>
<PackageFile Name="TestApp.exe"/>
</PackageFiles>
<InstallChecks>
<RegistryCheck Property="TestVersion" Key="REGISTRY_KEY_HERE" Value="Version" />
</InstallChecks>
<Commands Reboot="Defer">
<Command PackageFile="TestApp.exe" Arguments="">
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- Bypasses if TestApp version 3.6.3 or above is already installed -->
<BypassIf Property="TestApp" Compare="ValueGreaterThanOrEqualTo" Value="3.6.3"/>
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
<!-- Block install on less than Windows XP SP2 -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatformWinNT"/>
<!-- Block install on W2K3 with no service pack -->
<FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatformWinNT"/>
<!-- Block install if the platform is IA-64 -->
<FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="IA64" String="InvalidPlatformArchitecture" />
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="1602" Result="Fail" String="UserCancelled"/>
<ExitCode Value="1603" Result="Fail" String="GeneralFailure"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
<!-- Defines a localizable string table for error messages-->
<Strings>
<String Name="DisplayName">TestApp</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">Administrator permissions are required to install TestApp. Contact your administrator.</String>
<String Name="InvalidPlatformWinNT">Installation of TestApp requires Windows XP SP2, Windows 2003 SP1, Windows Vista, or later. Contact your application vendor.</String>
<String Name="InvalidPlatformArchitecture">This version of TestApp is not supported on an IA-64 operating system. Contact your application vendor.</String>
<String Name="UserCancelled">The user has cancelled the installation. TestApp has not been installed.</String>
<String Name="GeneralFailure">A failure occurred attempting to install TestApp.</String>
</Strings>
</Package>
由于
答案 0 :(得分:1)
我发现了问题...
clickOnce安装程序是一个32位进程,操作系统是64位,因此注册表检查键会自动重定向到WOW6432Node。