Bootstrapping SQL Express de WiX?
je travaille sur une application WPF, et J'utilise WiX comme installateur.
j'aimerais commencer à utiliser SQL Express 2012, mais je veux d'abord résoudre les problèmes d'installation.
je cherche un exemple complet de détection, de bootstrapping, d'installation, de mise à niveau et de désinstallation de SQL Express 2012 en utilisant WiX (bien que les partiels seront également utiles).
en outre, la plupart de la logique de détection que j'ai trouvé jusqu'à présent sur le web utilise des clés de registre. Cependant, Microsoft recommande D'utiliser WMI au lieu de cela (voir http://blogs.msdn.com/b/sqlexpress/archive/2006/07/29/faq-detecting-sql-server-2005-using-wmi.aspx). Est-ce possible avec WiX?
2 réponses
C'est ce que j'ai, espérons que cela aide:
<?define ServerInstall="SomeCondition" ?>
<?define InstanceName = "YOUR_INSTANCE" ?>
<?define SqlWebLink = http://download.microsoft.com/download/5/2/9/529FEF7B-2EFB-439E-A2D1-A1533227CD69/SQLEXPR_x86_ENU.exe ?>
<Variable Name="SqlVariable" Type="string" Value="/SAPWD=some_password" Hidden="yes" />
<!-- Read SQL Server keys to find current instance and version -->
<util:RegistrySearch
Id="SqlInstanceKeyFound"
Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Value="$(var.InstanceName)"
Result="exists" Variable="SqlInstanceKeyFound" />
<util:RegistrySearch
Id="SqlInstanceKey"
Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" Value="$(var.InstanceName)"
Variable="SqlInstanceKey" After="SqlInstanceKeyFound" Condition="SqlInstanceKeyFound" />
<util:RegistrySearch
Id="SqlInstanceFound"
Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SqlInstanceKey]"
Result="exists" Variable="SqlInstanceFound" After="SqlInstanceKey" Condition="SqlInstanceKeyFound" />
<util:RegistrySearch
Id="SqlVersion"
Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server\[SqlInstanceKey]\Setup" Value="Version"
Variable="SqlVersion" After="SqlInstanceKey" Condition="SqlInstanceFound" />
<PackageGroup Id="Sql2012Express">
<!--
SQL Server 2012 Express - Install new instance
http://msdn.microsoft.com/en-us/library/ms144259.aspx
SQL Server Express requires WIndows Installer 4.5
RepairCommand="/ACTION=Repair /INSTANCENAME=$(var.InstanceName) /Q /HIDECONSOLE"
-->
<ExePackage Id="Sql2012Express"
DisplayName="SQL Server 2012 Express"
Cache="yes"
Compressed="no"
PerMachine="yes"
Permanent="no"
Vital="yes"
Name="Redist\SQLEXPR_x86_ENU.exe"
SourceFile="..\Packages\SQLEXPR_x86_ENU.exe"
DownloadUrl="$(var.SqlWebLink)"
InstallCommand="/ACTION=Install /INSTANCENAME=$(var.InstanceName) /FEATURES=SQL /SECURITYMODE=SQL [SqlVariable] /TCPENABLED=1 /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /SQLSVCSTARTUPTYPE=Manual /SQLSYSADMINACCOUNTS=BUILTIN\Administrators /ADDCURRENTUSERASSQLADMIN=FALSE /Q /HIDECONSOLE /SkipRules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms"
UninstallCommand="/Action=Uninstall /INSTANCENAME=$(var.InstanceName) /FEATURES=SQL /Q /HIDECONSOLE"
DetectCondition="SqlInstanceFound"
InstallCondition="$(var.ServerInstall)">
<ExitCode Value ="3010" Behavior="forceReboot" />
<dep:Provides DisplayName="Net2 SQL Server 2012 Express" Key="SQLServer2012Express,$(var.InstanceName)" Version="11.0.3000.0" />
</ExePackage>
<!--
SQL Server 2012 Express - Upgrade existing pre-SQL 2012 instance
-->
<ExePackage Id="Sql2012ExpressUpgrade"
DisplayName="SQL Server 2012 Express Upgrade"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Name="Redist\SQLEXPR_x86_ENU.exe"
SourceFile="..\Packages\SQLEXPR_x86_ENU.exe"
DownloadUrl="$(var.SqlWebLink)"
InstallCommand="/ACTION=Upgrade /INSTANCENAME=$(var.InstanceName) /Q /HIDECONSOLE /SkipRules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms"
DetectCondition="NOT (SqlInstanceFound AND (SqlVersion < v11.0.0.0))"
InstallCondition="$(var.ServerInstall)">
<ExitCode Value ="3010" Behavior="forceReboot" />
</ExePackage>
<!--
SQL Server 2012 SP1 Express - Upgrade existing SQL 2012 instance to SP1
-->
<ExePackage Id="Sql2012ExpressEditionUpgrade"
DisplayName="SQL Server 2012 SP1 Express Patch"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Name="Redist\SQLEXPR_x86_ENU.exe"
SourceFile="..\Packages\SQLEXPR_x86_ENU.exe"
DownloadUrl="$(var.SqlWebLink)"
InstallCommand="/ACTION=Patch /INSTANCENAME=$(var.InstanceName) /Q /HIDECONSOLE /SkipRules=RebootRequiredCheck /IAcceptSQLServerLicenseTerms"
DetectCondition="NOT (SqlInstanceFound AND (SqlVersion > v11.0.0.0) AND (SqlVersion < v11.0.3000.0))"
InstallCondition="$(var.ServerInstall)">
<ExitCode Value ="3010" Behavior="forceReboot" />
</ExePackage>
vous devez changer les commandes d'installation pour correspondre à vos besoins.
Pas de suggestions a fonctionné pour moi jusqu'à 2 modifications:
set util:RegistrySearch/@Win64 attribuez la valeur à "oui" (par défaut "non", et c'est ok pour les systèmes 32bit)
supprimer ExePackage/@DetectCondition attribut (ne connaît pas la cause)
ci-Dessous est un exemple fonctionnel:
<util:RegistrySearch Id="SqlInstanceKeyFoundSearch"
Root="HKLM"
Key="SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL"
Value="SQLEXPRESSENGINE"
Result="exists"
Variable="SqlInstanceKeyFound"
Win64="yes" />
<PackageGroup Id="SQLServerExpress">
<ExePackage Compressed="no"
DisplayName="Installing SQL Server Express 2014"
PerMachine="yes"
Cache="yes"
Vital="yes"
Permanent="no"
InstallCommand='/IACCEPTSQLSERVERLICENSETERMS /HIDECONSOLE /INSTANCEID="$(var.InstanceName)" /ACTION="Install" /FEATURES=SQLENGINE /HELP="False" /INDICATEPROGRESS="False" /QUIET="True" /QUIETSIMPLE="False" /ERRORREPORTING="False" /SQMREPORTING="False" /INSTANCENAME="$(var.InstanceName)" /AGTSVCSTARTUPTYPE="Manual" /ISSVCSTARTUPTYPE="Automatic" /ISSVCACCOUNT="NT AUTHORITY\NetworkService" /ASSVCSTARTUPTYPE="Automatic" /ASCOLLATION="Latin1_General_CI_AS" /ASDATADIR="Data" /ASLOGDIR="Log" /ASBACKUPDIR="Backup" /ASTEMPDIR="Temp" /ASCONFIGDIR="Config" /ASPROVIDERMSOLAP="1" /SQLSVCSTARTUPTYPE="Automatic" /FILESTREAMLEVEL="0" /ENABLERANU="True" /SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS" /SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE" /ADDCURRENTUSERASSQLADMIN="True" /TCPENABLED="0" /NPENABLED="0" /BROWSERSVCSTARTUPTYPE="Disabled" /RSSVCSTARTUPTYPE="Automatic" /RSINSTALLMODE="FilesOnlyMode" /SECURITYMODE=SQL /SAPWD="tomsoN_admin_1032"'
UninstallCommand='/Action=Uninstall /INSTANCENAME="$(var.InstanceName)" /FEATURES=SQLENGINE /QUIET="True" /HIDECONSOLE'
InstallCondition="NOT SqlInstanceKeyFound"
DownloadUrl="https://download.microsoft.com/download/1/5/6/156992E6-F7C7-4E55-833D-249BD2348138/ENU/x64/SQLEXPR_x64_ENU.exe"
Name="SQLEXPR_x64_ENU.exe">
<RemotePayload CertificatePublicKey="B78FE7F6917E1BC5F4A9C77BA3D555A0E807B9E0" CertificateThumbprint="67B1757863E3EFF760EA9EBB02849AF07D3A8080" Description="Microsoft SQL Server 2014 Express SP1" Hash="0C90C147A1C2A550165C9301AE7A6C604E318E51" ProductName="Microsoft SQL Server 2014 Express SP1" Size="318752832" Version="12.1.4100.1" />
</ExePackage>
</PackageGroup>