安装 SQL Server 2014 Express 作为引导程序的先决条件

Installing SQL Server 2014 Express as a prerequisite in boostrapper

我正在尝试使用 boostrapper (Wix 3.11) 进行安装,前提是 SQL Server 2014 Express。

当我使用命令行安装 setup.exeSQLEXPR_x64_ENU.exe 时效果很好。

命令行如下:

SQLEXPR_x64_ENU.exe /q /ACTION=Install /FEATURES=SQL 
       /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT="NT AUTHORITY\Network Service"  
       /SQLSYSADMINACCOUNTS="NT AUTHORITY\Network Service" 
       /AGTSVCACCOUNT="NT AUTHORITY\Network Service" 
       /IACCEPTSQLSERVERLICENSETERMS /SECURITYMODE=SQL SAPWD="TestPassWord"

但是,当我尝试从 boostrapper 运行 它时失败了。它总是抛出相同的错误。

Error: Action "Microsoft.SqlServer.Configuration.SetupExtension.ValidateFeatureSettingsAction" threw an exception during execution.
Microsoft.SqlServer.Setup.Chainer.Workflow.ActionExecutionException: Value cannot be null.
Parameter name: userName ---> System.ArgumentNullException: Value cannot be null.

以下是我用来设置安装程序的代码:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"> 
      <?define Account = 'NT AUTHORITY\Network Service'?>
      <?define SAPassword = "TestPassWord"?>     
        <Bundle Name="Setup" Version="1.0.0.0" Manufacturer="Company" UpgradeCode="{GUID}">
            <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
        <bal:WixStandardBootstrapperApplication
            LicenseUrl=""
            ThemeFile="HyperlinkTheme.xml"
            LocalizationFile="HyperlinkTheme.wxl"
            SuppressOptionsUI="yes" />
        </BootstrapperApplicationRef>
            <Chain>
          <ExePackage Id ="SQL_express" SourceFile="$(var.PreReqPath)\SQLExpress\SQLEXPR_x64_ENU.exe" Compressed="yes" Vital="no" InstallCommand="/q /ACTION=Install /FEATURES=SQL /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT=$(var.Account) /SQLSYSADMINACCOUNTS=$(var.Account) /AGTSVCACCOUNT=$(var.Account) /IACCEPTSQLSERVERLICENSETERMS /SECURITYMODE=SQL /SAPWD=$(var.SAPassword)" />
            </Chain>
        </Bundle>
</Wix>

我尝试将 Permachine="Yes" 添加到 ExePackage 行,但它没有解决问题。

我也试过右键单击安装程序并运行它作为管理员,但它仍然不起作用。

希望有人能帮我解决这个问题。

有一段时间没看这个了,但现在似乎没有其他人在附近。我试试看:我猜你在你的源代码中使用了 ,而不是 运行time variables.换句话说,"$(var.VariableName)" 条目在 build-time (when your WiX Bundle is compiled - which is sometimes OK) 而不是 运行-time (when your WiX Bundle is installed - which is often desired).

In other words I would assume your pre-processor variables resolve to blank strings during compilation, and that is why your install does not work. There are no values specified at all for all pre-processor fields.

As a test, maybe compile your bundle with some hard-coded values as a "smoke test", to determine if this is the case. Then try the Variable element described below.

模型:

<ExePackage Id ="SQL_express" SourceFile="SQLEXPR_x64_ENU.exe" Compressed="yes" Vital="no" InstallCommand="/q /ACTION=Install /FEATURES=SQL /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT=TestAccount /SQLSYSADMINACCOUNTS=SqlAccount /AGTSVCACCOUNT=SvcAccount /IACCEPTSQLSERVERLICENSETERMS /SECURITYMODE=SQL /SAPWD=SAPassword" />

也许您可以查看 Neil Sleightholm 的博客,了解如何解决这个问题(我没有要添加的完整示例): http://neilsleightholm.blogspot.com/2012/05/wix-burn-tipstricks.html

我认为关键是 Variable element:

<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]ACME\My App" />

看起来您可以通过将 Overridable attribute 设置为 yes(该 link 的页面底部)来在命令行中覆盖这些值。我从来没有试过这个。看起来这些变量元素使用标准 MSI 大括号约定解析:[InstallFolder]。示例:

<MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" /> 

See Sleightholm's template again for full context for the above fragments. You will be using an ExePackage instead of an MsiPackage显然。

您似乎可以忽略用例的 WixVariable element(相对于 Variable element 你会需要的)。