How do I get MSI (using InstallShield) to load Microsoft.Deployment.WindowsInstaller dll from my application install directory?

StackOverflow https://stackoverflow.com/questions/19611471

Question

I have very simple managed CA which uses Microsoft.Deployment.WindowsInstaller:

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

}

I compile this with net4. I have a Managed CA in InstallShield2012 'stored in binary table' with method signature method=TestDtf, arguments=value:MsiHandle,Parameter:Microsoft.Deployment.WindowsInstaller

I'm not sure I'm calling this right, but even this isn't my immediate problem. The problem seems to be that msiexec only looks in the system folder for Microsoft.Deployment.WindowsInstaller.dll, instead of somewhere like the folder where I have just installed this assembly and confirmed it is there after CopyFiles.

Here is partial log:

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)

If I manually drop the Microsoft.Deployment.WindowsInstaller.dll into syswow64, it loads fine. Not sure I want to install this to our clients system folder however...

How do I set up my installer so that it can find Microsoft.Deployment.WindowsInstaller.dll?

Was it helpful?

Solution

You are going about this all wrong. When you build the DTF project FOO you get FOO.DLL and FOO.CA.DLL. It's the FOO.CA.DLL that you add to InstallShield as a Windows Installer DLL custom action. DTF wraps FOO.DLL inside FOO.CA.DLL and packages any other files including the Microsoft.Deployment.WindowsInstaller.dll interop in there for you.

Take a look at:

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

Rename the FOO.CA.DLL to FOO.CA.ZIP and open it in 7Zip or WinZip. You'll see the other files in there.

OTHER TIPS

It looks like the way to solve this is to create an entry in the ISClrWrap table of:

Action: {nameOfCustomAction}
Name: Dependency0
Value: Path to the dependency in this case Microsoft.Deployment.WindowsInstaller.dll (you can use a path variable with this)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top