【问题标题】:How do I get MSI (using InstallShield) to load Microsoft.Deployment.WindowsInstaller dll from my application install directory?如何让 MSI(使用 InstallShield)从我的应用程序安装目录加载 Microsoft.Deployment.WindowsInstaller dll?
【发布时间】:2013-10-26 20:20:39
【问题描述】:

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

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

}

我用net4编译这个。我在 InstallShield2012 中有一个托管 CA '存储在二进制表中',方法签名 method=TestDtf, arguments=value:M​​siHandle,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?

【问题讨论】:

    标签: wix installshield custom-action


    【解决方案1】:

    你做错了。当您构建 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 中打开它。您会在其中看到其他文件。

    【讨论】:

    • 我没有使用 SDK 附带的 Visual Studio 中的 Windows Installer XML 项目类型 - 所以我没有得到执行本文中解释的所有魔法的构建后事件。谢谢!
    【解决方案2】:

    看起来解决这个问题的方法是在ISClrWrap 表中创建一个条目:

    Action: {nameOfCustomAction}
    Name: Dependency0
    Value: Path to the dependency in this case Microsoft.Deployment.WindowsInstaller.dll (you can use a path variable with this)
    

    【讨论】:

    • 您缺少 DTF 的值。它已经为托管桥提供了本机。 InstallShield 不需要知道它是托管的。
    猜你喜欢
    • 2021-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-04
    • 1970-01-01
    相关资源
    最近更新 更多