0

我正在尝试通过以下链接在我的 wix 安装程序中从网络安装 SQL Server 2019 速成版: https ://www.microsoft.com/en-us/sql-server/sql-server-downloads

但看起来这个 SQL express 安装程序只接受 CMD 参数中的配置(/ConfigurationFIle="filePath"),所以我的问题是如何捆绑我的 sql express 配置文件,以便在安装 SQL express 时使用它

<ExePackage
    InstallCommand="/ACTION=Install /Q /IAcceptSQLServerLicenseTerms /ConfigurationFile=&quot;MyConfigFile.ini&quot;"
    Name="redist\setup.exe"
    DownloadUrl="https://go.microsoft.com/fwlink/?linkid=866658"
    .../>
</ExePackage>
4

1 回答 1

0

好的,我找到了一种捆绑配置文件的方法,以便我的 exePackage 可以使用它:

<ExePackage
    InstallCommand="/ACTION=Install /Q /IAcceptSQLServerLicenseTerms /ConfigurationFile=&quot;[WixBundleExecutePackageCacheFolder]MyConfigFile.ini&quot;"
    Name="redist\setup.exe"
    DownloadUrl="https://go.microsoft.com/fwlink/?linkid=866658"
    .../>
    <Payload Id="ConfigurationFileSqlExpress"
        Compressed="yes"
        SourceFile="$(env.PREREQUISITE_FOLDER)\redist\ConfigurationFileSqlExpress.ini"
        Name="ConfigurationFileSqlExpress.ini" />
</ExePackage>

事实证明,我需要做的就是在 ExePackage 中添加一个 Payload 元素,并提供我想使用的配置文件的详细信息(SourceFile,Name)。确保在 Payload 的名称中包含扩展名 .ini(SQL 安装程序需要 .ini 文件进行配置)

然后将以下内容添加到 InstallCommand 中,以便可以将配置文件路径传递给 SQL 安装程序:

/ConfigurationFile=&quot;[WixBundleExecutePackageCacheFolder]ConfigurationFileSqlExpress.ini&quot;

[WixBundleExecutePackageCacheFolder]:(内置变量),获取当前执行包的缓存文件夹的绝对路径。此变量仅在包执行时可用。

参考:

想法: http: //windows-installer-xml-wix-toolset.687559.n2.nabble.com/SqlExpress-Exepackage-InstallCommand-ConfigurationFile-tp7593994p7601003.html

SQL 服务配置文件:https ://docs.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-using-a-configuration-file?view=sql-server-ver15

于 2020-04-02T23:47:47.400 回答