1

I am using wix toolset to create MSI build.

Here is the Binary source in Product.wxs file.

    <Binary Id="BI.CA" 
         SourceFile="..\..\CustomAction\bin\$(var.Configuration)\CustomAction.CA.dll" />

MSI generated and works as expected in local but fails in build machine showing below error.

Could not find CustomAction.CA.dll

I see that CustomAction.CA.dll is present in the build machine but not the path which I specified.

How do I embed this dll in to MSI?

Update

In build machine, I see the DLL here

E:\BuildAgent\1\b\CustomAction.CA.dll"

kudlatiger
  • 3,028
  • 8
  • 48
  • 98
  • Have you added a dll reference to your wix project? – Pavel Anikhouski Aug 08 '19 at 08:29
  • I added as project reference – kudlatiger Aug 08 '19 at 08:36
  • 1
    Did I send you my [WiX quick-start ad-hoc lunatic answer](https://stackoverflow.com/a/25005864/129130) before? Just heading out the door, there are [sample links](https://github.com/rstropek/Samples/tree/master/WiXSamples/CustomActionCSharp). Perhaps one of them has what you need. Otherwise, try [github.com](http://github.com). – Stein Åsmul Aug 08 '19 at 13:26
  • Throwing in [this C++ CA answer](https://stackoverflow.com/questions/54925087/interrupt-installation-when-custom-action-returns-error). And [one more](https://stackoverflow.com/questions/54285093/wix-custom-action-session-empty-and-error-on-deferred-action/54298965#54298965). Probably not useful, just lobbing some links on the run. – Stein Åsmul Aug 08 '19 at 13:32
  • @SteinÅsmul I made it work by adding $(TargetDir) in source file path. it worked now on build machine. but fails in local :) anyways let me read your documents. Meanwhile now I am stuck with upgrade issues. Might create new quesiton if I do not find answer any where else. basically it says "anouther verson already exists" but I have changed verison number and GUID ID in new MSI – kudlatiger Aug 08 '19 at 16:26

1 Answers1

2

When your DLL has the name CustomAction.CA.dll that should not be! Then you need to double the CA here <Binary Id="BI.CA" SourceFile="..\..\CustomAction\bin\$(var.Configuration)\CustomAction.CA.CA.dll" />

The CA is an internal postfix for the DLL but the output / target of your Custom Action Library should not have it in the name.

You have two options:

a) Remove the CA from the output target in Custom Action project
b) Introduce a second CA in MSI-Project Binary Element

See also How to execute a WiX custom action DLL file with dependencies

KargWare
  • 1,746
  • 3
  • 22
  • 35