0

My wix wxs has a CustomAction written by c++: HSRInstall.dll. Inside this dll, windows swdevice.lib, new.lib are linked. So it requires running with vcruntime140.dll. When user execute this msi package on a clean install windows server 2019 datacenter, without a vcruntime140.dll in C:\Windows\System32, it will fail to be installed.

<Binary Id="HSRInstalldll" SourceFile="HSRInstall.dll" />
<CustomAction Id="deletehsrservicecache" BinaryKey="HSRInstalldll" DllEntry="HSRCustomAction" Execute="deferred" Impersonate="no" Return="ignore" />       

When I add vcruntime140.dll as binary element in wxs, its file name is changed when installing. How to add the vcruntime library that the dynamic library depends on to the wix package? Thanks!

Acewind
  • 133
  • 9
  • [An old answer on C++ custom actions](https://stackoverflow.com/a/54929785/129130). There is a section on minimal dependencies, but remember that the answer is quite old now. Please have a look. – Stein Åsmul Feb 12 '23 at 16:58

1 Answers1

0

The best option is to statically link the C runtime (CRT) into your custom action dll. That way you do not have a dependency outside of your installation package.

We statically link the CRT in all the WiX custom actions.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130