问题
I am trying to use boostrapper (Wix 3.11) to set up an installation, with SQL Server 2014 Express as a prerequisite.
It works well when I install setup.exe
or SQLEXPR_x64_ENU.exe
with command line.
The command line is the following :
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"
However, it fails when I try to run it from boostrapper. It always throws the same error.
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.
The following is the code I'm using to set up an installer:
<?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>
I have tried to add Permachine="Yes" to the ExePackage line but it doesn't solve the problem.
I have also tried to right-click on the installer and run it as administrator but it still doesn't work.
Hopefully someone can help me with this issue.
回答1:
Haven't looked at this in a while, but nobody else seems to be around right now. I'll give it a go: I guess you are using pre-processor variables in your source there, and not runtime variables. In other words the "$(var.VariableName)"
entries are resolved at build-time (when your WiX Bundle is compiled - which is sometimes OK
) and not at run-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.
Mockup:
<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" />
Maybe you can have a look at Neil Sleightholm's blog for some ideas how to approach this (I don't have a fully working sample to add): http://neilsleightholm.blogspot.com/2012/05/wix-burn-tipstricks.html
I think the key is the Variable element:
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]ACME\My App" />
It looks like you can override such values at the command line by setting the Overridable attribute to yes
(bottom of the page for that link). I have never tried this. It looks like these Variable elements resolve using the standard MSI-brace convention: [InstallFolder]
. Sample:
<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 obviously.
It appears you can ignore the WixVariable element for your use-case (as opposed to the Variable element which you will need).
来源:https://stackoverflow.com/questions/51449284/installing-sql-server-2014-express-as-a-prerequisite-in-boostrapper