从WiX引导SQL Express? [英] Bootstrapping SQL Express from WiX?

查看:208
本文介绍了从WiX引导SQL Express?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WPF应用程序,并使用WiX作为安装程序.

I'm working on a WPF app, and using WiX as an installer.

我想开始使用SQL Express 2012,但想首先解决安装程序问题.

I'd like to start using SQL Express 2012, but want to resolve installer issues first.

我正在寻找使用WiX检测,引导,安装,升级和卸载SQL Express 2012的完整示例(尽管部分操作也很有用).

I'm looking for a full-up example of detecting, bootstrapping, installing, upgrading and uninstalling SQL Express 2012 using WiX (although partials will be useful, too).

此外,到目前为止,我在网络上发现的大多数检测逻辑都使用注册表项.但是,Microsoft建议改为使用WMI(请参阅

Also, most of the detection logic I've found so far on the web uses registry keys. However, Microsoft recommends using WMI instead (see http://blogs.msdn.com/b/sqlexpress/archive/2006/07/29/faq-detecting-sql-server-2005-using-wmi.aspx). Is that possible using WiX?

推荐答案

这就是我所拥有的,希望对您有所帮助:

This is what I have, hope it helps:

<?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=&quot;NT AUTHORITY\NETWORK SERVICE&quot; /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 &lt; 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 &gt; v11.0.0.0) AND (SqlVersion &lt; v11.0.3000.0))"
    InstallCondition="$(var.ServerInstall)">
    <ExitCode Value ="3010" Behavior="forceReboot" />
  </ExePackage>

您需要更改安装命令以符合您的要求.

You would need to change the install commands to match your requirements.

这篇关于从WiX引导SQL Express?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆