Вопрос

I am chaining a batch file in Bundle.wxs as an "ExecPackage". The batch file expects a parameter/commandline argument.

<ExePackage Id="Test" SourceFile="D:\TestBatch.bat" Vital="yes" InstallCondition="SelectedDBSize = 24" InstallCommand=""/>

How do I pass commandline arguments/parameters in the "ExecPackage". Can InstallCommand attribute be used for this? If so can somebody give me a small example to illustrate the same?

Это было полезно?

Решение

This is currently what I use to install SqlExpress 2008 R2 as part of my bundle:

<ExePackage Id="SqlExpress2008R2"
            Cache="no"
            Compressed="no"
            PerMachine="yes"
            Permanent="no"
            Vital="yes"
            InstallCommand="/QS /ACTION=Install /IACCEPTSQLSERVERLICENSETERMS /BROWSERSVCSTARTUPTYPE=Automatic /SQLSVCSTARTUPTYPE=Automatic /FEATURES=SQL /INSTANCENAME=[SqlInstance] /SQLSVCACCOUNT=&quot;NT AUTHORITY\Network Service&quot; /SQLSYSADMINACCOUNTS=&quot;BUILTIN\ADMINISTRATORS&quot; /AGTSVCACCOUNT=&quot;NT AUTHORITY\Network Service&quot; /SECURITYMODE=SQL /SAPWD=&quot;[SqlAdminUserPassword]&quot;"
            Name="redist\SQLEXPR_x86_ENU.exe"
            DownloadUrl="http://download.microsoft.com/download/D/1/8/D1869DEC-2638-4854-81B7-0F37455F35EA/SQLEXPR_x86_ENU.exe"
            InstallCondition="NOT SQLServer2008R2Installed AND NOT SQLServerInstalled">
    <RemotePayload ProductName="SQL Server 2008 R2 Express SP1"
                   Description="SQL Server 2008 R2 Express SP1" 
                   CertificatePublicKey="5C499B10F7EF186DC729991A262AB52066423909" 
                   CertificateThumbprint="93859EBF98AFDEB488CCFA263899640E81BC49F1" 
                   Hash="6F399D641F322A3E47E3DD605F2A2EDF21074375"  
                   Size="111274848" 
                   Version="10.50.2500.0" />
  </ExePackage>

The parts in the InstallCommand attribute surrounded with square-brackets (e.g. [SqlInstance]) are supplied by the bundle variables that can be supplied to the bundle exe on the command-line:

<Variable Name="SqlInstance"
          Value="SQLEXPRESS"
          bal:Overridable="yes" />

Note the important attribute bal:Overridable="yes" this means that it can be set via the bundles command-line, without it it will just be an internal variable (set by registry search for example).

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top