如何获得MSI(使用InstallShield)从应用程序安装目录加载Microsoft.Deployment.WindowsInstaller dll?

约翰·扎伊

我有一个非常简单的使用Microsoft.Deployment.WindowsInstaller的托管CA:

[CustomAction]
public static ActionResult TestDtf(Session session)
{
    MessageBox.Show("Test");
    ActionResult result = ActionResult.Success;
    return result;

}

我用net4编译它。我在“存储在二进制表中”的InstallShield2012中有一个托管CA,方法签名为method = TestDtf,arguments = value:MsiHandle,Parameter:Microsoft.Deployment.WindowsInstaller

我不确定我是否正确,但是即使这不是我的直接问题。问题似乎是msiexec仅在Microsoft.Deployment.WindowsInstaller.dll的系统文件夹中查找,而不是在我刚刚安装此程序集并确认在CopyFiles之后存在该文件夹的位置。

这是部分日志:

InstallShield: Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Deployment.WindowsInstaller, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.Deployment.WindowsInstaller, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ce35f76fcda82bad'
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParameters()
   at InstallShield.ClrHelper.CustomActionHelper.PrepareParameters(EntryPointInfo info, Boolean& anyHidden)

如果我手动将Microsoft.Deployment.WindowsInstaller.dll放到syswow64中,它将很好地加载。不确定我是否要将其安装到我们的客户端系统文件夹中...

如何设置我的安装程序,以便它可以找到Microsoft.Deployment.WindowsInstaller.dll?

克里斯托弗·画家

您正在解决所有这些错误。当您构建DTF项目FOO时,您将获得FOO.DLL和FOO.CA.DLL。这是您作为Windows Installer DLL自定义操作添加到InstallShield的FOO.CA.DLL。DTF将FOO.DLL包装在FOO.CA.DLL中,并在其中为您打包其他任何文件,包括Microsoft.Deployment.WindowsInstaller.dll互操作。

看一眼:

http://blog.iswix.com/2008/05/deployment-tools-foundation-dtf-managed.html

将FOO.CA.DLL重命名为FOO.CA.ZIP并在7Zip或WinZip中将其打开。您将在其中看到其他文件。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章