自定义 msi 中的 SQL Server setup.exe 导致 StackOverflowException
我正在尝试创建一个也安装 SQL Server 的 .msi 安装程序(如果用户有磁盘/iso 文件)。
它的工作原理是:
- 它运行一个批处理文件,并且该批处理文件在任何驱动器中找到 setup.exe。
- 该批处理文件采用 2 个参数,即配置文件的位置和 msi 的安装目录,
- 然后它搜索 setup.exe 并使用配置文件运行它,执行静默安装。
无论我以何种方式运行它,参数似乎都完全相同。
@echo off
::this file searches for the setup.exe and then installs the server.
::ARGUMENTS:Complete Path to the Configuration File
::ATTENTION: this will need to search for a more unique file in the future!
::loop through each letter for a drive
for %%A in (D E F G H I J K L M N O P Q R S T U V W X Y Z) Do (
::check if file exists, send any error messages to NUL, destroying it(e.g. no disk in drive) and installif found
DIR "%%A:/setup.exe" 1>NUL 2>&1 && call:install %%A %1 %2
::if we reach here the file ahsn't been found
if %%A == Z (
@echo Please insert the Microsoft SQL Server 2008 R2 disk and try again.
pause
exit
)
)
:install
net user grp-db ..grp.. /add
echo Installing SQL Server 2008 R2 with %~2
date/t
time /t
::"%~1:\setup.exe" /ConfigurationFile="%~2"
DIR "%~2"
date/t
time /t
pause
echo Creating ODBC data source.. with %~3
::"%~3"ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=GRP_DSN | Description=GRP Data Source | SERVER=(local) | Trusted_Connection=Yes"
exit
goto:eof
从命令提示符运行批处理文件可以按预期完美运行,但在 msi 中会导致 StackOverflowException。检查 SQL 目录中的摘要文件显示
用户取消了操作。异常类型:Microsoft.SqlServer.Chainer.Infrastruct.CancelException。
有没有人有任何想法从哪里开始?
I'm trying to create an .msi installer that also installs SQL Server (if the user has the disk/iso file).
How it should work is:
- it runs a batch file, and the batch file finds the setup.exe in whichever drive it is.
- The batch file takes 2 arguments, the location of the configuration file and the install directory of the msi
- it then searches for setup.exe and runs it with the config file, performing a silent install.
The arguments seem to be exactly the same which ever way I run it.
@echo off
::this file searches for the setup.exe and then installs the server.
::ARGUMENTS:Complete Path to the Configuration File
::ATTENTION: this will need to search for a more unique file in the future!
::loop through each letter for a drive
for %%A in (D E F G H I J K L M N O P Q R S T U V W X Y Z) Do (
::check if file exists, send any error messages to NUL, destroying it(e.g. no disk in drive) and installif found
DIR "%%A:/setup.exe" 1>NUL 2>&1 && call:install %%A %1 %2
::if we reach here the file ahsn't been found
if %%A == Z (
@echo Please insert the Microsoft SQL Server 2008 R2 disk and try again.
pause
exit
)
)
:install
net user grp-db ..grp.. /add
echo Installing SQL Server 2008 R2 with %~2
date/t
time /t
::"%~1:\setup.exe" /ConfigurationFile="%~2"
DIR "%~2"
date/t
time /t
pause
echo Creating ODBC data source.. with %~3
::"%~3"ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=GRP_DSN | Description=GRP Data Source | SERVER=(local) | Trusted_Connection=Yes"
exit
goto:eof
Running the batch file from Command Prompt works perfectly as expected but in the msi it causes a StackOverflowException. Checking the Summary file in the SQL directory says
The user cancelled the operation. Exception type: Microsoft.SqlServer.Chainer.Infrastructure.CancelException.
Has anybody got ANY ideas where to even start with this one?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

SQL Server 安装和您的 MSI 进程之间似乎存在冲突。
您可以尝试将其添加为 MSI 的先决条件,而不是使用 BAT 来安装 SQL Server:
It looks like there is a conflict between the SQL Server installation and your MSI process.
Instead of using a BAT for installing SQL Server, you can try adding it as a prerequisite for your MSI: