我的应用程序需要 MS SQL Server 作为其先决条件之一。现在我想将客户端计算机升级到 MS SQL Server 2008 R2 Express Edition,如果他们有 MS SQL Server 2005 Express Edition。我无法实现它。下面是我在客户端计算机上未安装 SQL 服务器时用于下载和安装 MS SQL Server 2008 R2 速成版的 Wix 代码。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<util:RegistrySearch Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\MyInstanceName"
Variable="Instance"
Result="exists"
/>
<PackageGroup Id="SqlServer2008R2">
<ExePackage InstallCommand='/q /action=INSTALL /HIDECONSOLE /IACCEPTSQLSERVERLICENSETERMS=1 /FEATURES=SQLEngine /INSTANCENAME=MyInstanceName /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /SECURITYMODE=SQL /SAPWD=abc#Wd1234 /ADDCURRENTUSERASSQLADMIN=TRUE /SQLSYSADMINACCOUNTS="NT AUTHORITY\SYSTEM" /TCPENABLED=1 /NPENABLED=1'
InstallCondition="NOT VersionNT64"
DetectCondition="Instance"
Compressed="no"
Vital="yes"
PerMachine="yes"
Name="SQLEXPR32_x86_ENU.exe"
Permanent="yes"
Cache="no"
DownloadUrl="http://download.microsoft.com/download/5/1/A/51A153F6-6B08- 4F94-A7B2-BA1AD482BC75/SQLEXPR32_x86_ENU.exe"
>
<RemotePayload
Size="60995936"
ProductName="Microsoft SQL Server 2008 R2 Express"
Description="Microsoft SQL Server 2008 R2 Express"
Version="10.50.1600.1"
CertificatePublicKey="672605E36DD71EC6B8325B91C5FE6971390CB6B6"
CertificateThumbprint="9617094A1CFB59AE7C1F7DFDB6739E4E7C40508F"
Hash="ACF5494D18EDF117A2683D66A96FB8954F98D86D"
/>
</ExePackage>
</PackageGroup>
</Fragment>
</Wix>