Search code examples
visual-studio-2010visual-c++mfcwixcustom-action

VC++ custom action for Wix


We are using CustomActions written in VC++ in our WIX msis. it is working fine in Windows7 machine. But when we tried to run the msi in Win 10 it is not working and failing because Microsoft Visual C++ 2010 Redistributable Package is not installed by default in Win 10 machine. So for making the MSI to work we should install Microsoft Visual C++ 2010 Redistributable Package. But the problem is that we can't install it along with the MSi because the custom actions are responsible for choosing the INSTALLDIR and this will happen before installing anything.So my question is

1.)Do we really need Visual C++ 2010 Redistributable for running VC++ custom actions.?

2.)How can i install it before choosing the INSTALLDIR?


Solution

  • Simply compile your DLL with static libraries. In this case your DLL has no additional dependencies.

    In the project settings set General->Use of MFC to Use MFC in a static library.

    Under C/C++ -> Code Generation choose the options Multithreaded or Multithreaded Debug /MT or /MTd.

    You can use the Dependency Walker to check out if you need more DLLs that must be installed.