我正在尝试使用 Windows Installer Embedded 链安装多个 .msi。我从一个网站上研究了一些信息并尝试了它。但它不起作用(WiX + C#)。
- 当我检查调试时,它可以成功运行,
transaction.Commit()
直到transaction.close()
. 但是SampleApp.msi
没有安装。 - 'Multiple MISs Installer' 安装成功,即使
SampleApp.msi
没有工作,我也无法卸载'Multiple MISs Installer'。错误日志中的条目是“安装过程中的致命错误”。
我如何解决它?
多个 MSI 安装程序\Product.wxs
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Multiple Installer">
<Component Id="InstallMSIComponent" Guid="{7091DE57-7BE3-4b0d-95D5-07EEF6463B62}">
<File Id="FILE_MprjChainer.exe" Name="MprjChainer.exe"
Source="C:\A_VS2008\WiX\MprjChainer\MprjChainer\bin\Debug\MprjChainer.exe"
DiskId="1" KeyPath="yes"/>
<File Id="Microsoft.Deployment.WindowsInstaller.dll"
Name="Microsoft.Deployment.WindowsInstaller.dll"
Source="C:\Program Files\Windows Installer XML v3.5\SDK\Microsoft.Deployment.WindowsInstaller.dll" />
<File Id="System.dll"
Name="System.dll"
Source="C:\windows\Microsoft.NET\Framework\v2.0.50727\System.dll" />
<File Id="System.Core.dll" Name="System.Core.dll"
Source="C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" />
<File Id="System.Windows.Forms.dll" Name="System.Windows.Forms.dll"
Source="C:\windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" />
<File Id="System.Xml.dll"
Name="System.Xml.dll"
Source="C:\windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll" />
<File Id="System.Xml.Linq.dll"
Name="System.Xml.Linq.dll"
Source="c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" />
<RemoveFolder Id="INSTALLLOCATION" On="uninstall"/>
</Component>
<Component Id="CMPG_SimpleApp" Guid="{CB568AA4-9790-4efd-91BB-82682F063321}">
<File Id="SimpleApp.msi"
Name="SimpleApp.msi"
Source="C:\A_VS2008\WiX\MSIs\SimpleApp.msi"
DiskId="1" KeyPath="yes"/>
</Component>
</Directory>
</Directory>
</Directory>
<EmbeddedChainer Id="Chainer" FileSource="FILE_MprjChainer.exe"/>
<Feature Id="ProductFeature" Title="MPrjInstaller" Level="1">
<ComponentRef Id="InstallMSIComponent"/>
<ComponentRef Id="CMPG_SimpleApp"/>
<ComponentGroupRef Id="Product.Generated" />
</Feature>
Chainer\CustonAction.cs
namespace MprjChainer
{
public class CustomActions
{
static void Main(string[] args)
{
System.Diagnostics.Debugger.Launch();
try
{
IntPtr ptr = new IntPtr(Convert.ToInt32(args[0], 16));
Transaction transaction = Transaction.FromHandle(ptr, true);
transaction.Join(TransactionAttributes.JoinExistingEmbeddedUI);
transaction.Commit();
transaction.Close();
}
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show("e.Message; " + e.Message);
throw e;
}
}
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
System.Diagnostics.Debugger.Launch();
session.Log("Begin CustomAction1");
return ActionResult.Success;
}
}
}