简体   繁体   中英

(Wix installer) how to include custom action dependency

I got 3 projects in Install solution:

  1. Custom Action dll written in c#
  2. Custom Action dll written in c++
  3. Util dll written in c++ also (c# and c++ uses it, as interoop)

The question is how to add Util.dll into wix installer,

When I copy/paste this dll into C:\\ProgramFiles\\SystemWOW64\\ (the msiexec.exe directory) all works fine, but its a bad workaround which I would to avoid.

What I've tried: 1) Add as reference to the MSI project and include as:

   <?xml version="1.0" encoding="utf-8"?>
   <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
      <Fragment>
         <Binary Id="CPlusPlusAction" SourceFile="$(var.CPlusPlusAction.TargetDir)$(var.CPlusPlusAction.TargetName).CA.dll"/>
         <Binary Id="CSharpAction" SourceFile="$(var.CSharpAction.TargetPath)"/>
         <Binary Id="Utils" SourceFile="$(var.SolutionDir)/$(var.Utils.Configuration)/Utils.dll"/>
         <CustomAction Id="FunctionOne" Impersonate="no" Return="ignore" Execute="commit" BinaryKey="CPlusPlusAction" DllEntry="FunctionOne" />
         <CustomAction Id="FunctionTwo" Impersonate="no" Return="ignore" Execute="commit" BinaryKey="CSharpAction" DllEntry="FunctionTwo"/>
      </Fragment>
  </Wix>

2) Add as reference to both projects with CopyLocal = true

I've googled a lot but still can't find the solution ( Wix Doc , StackOverflow, msdn etc)

Thanks in advance

For C# managed custom actions I don't think you can add the native dll as a reference. So instead add it as content with action copy and I'm pretty sure DTF will package it up and make it available in the temp directory (current directory of the process) at custom action execution time.

For C++, I use the ISSetup.dll / ISSetupFile pattern from InstallShield or statically link the library if you can.

Thanks for answer guys, but finally I figured it out.

First of all you need to add this Util.dll to Msi binary table:

<Binary Id="Utils" SourceFile="$(var.SolutionDir)/$(var.Utils.Configuration)/Utils.dll"/>

If you are not sure use Orca for seeing it inside .msi file

Second as Christopher said for c# its enaught to RightClick -> Add Existing project -> Utill.dll, then DFS extract it during installation into C:/windows/installation/"CustomActionId" and everything works, but...

problem is with c++ side, the Wix isn't for this language, so you need to care of everything during installation, for example write code which will read the BinaryTable for installer, read data and clean all msdn it's a lot of code

so I prefer to write CLR wrapper for util, Build Util as lib, so on c++ side its build inside CA.dll, and add as lib to wrapper, so now you can use wrapper.dll in c#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM