The problem is when I run the setup.msi, RESTORE DATABASE terminate abnormally error code is returned but when I run the query in ssms, it's working fine. Is there any limitation of sqlstring element?
<?xml version="1.0" encoding="UTF-8"?>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="SQLRestore" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SQLRestore" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="CMP_Database_Autoruns" Guid="75FAEA47-E1E3-4A58-9528-4577968EA058" KeyPath="yes">
<sql:SqlDatabase Id="Database_MyDB" Server="[ComputerName]\EXPRESS2019" Database="Test" CreateOnInstall="no" DropOnUninstall="yes">
<sql:SqlString Id="SQL_CreateMyTable"
SQL="RESTORE DATABASE Test
FROM DISK = N'F:\Bak\KK2.bak' WITH FILE = 1,
MOVE N'Test' TO N'F:\DATA\TTest.mdf',
MOVE N'Test_log' TO N'F:\DATA\TTest_log.ldf',
NOUNLOAD,
REPLACE,
STATS = 5;" ContinueOnError="no" ExecuteOnInstall="yes"/>
</sql:SqlDatabase>
</Component>
</ComponentGroup>
</Fragment>