2

I have a WIX installer which I need to also install the VC++ 2015 runtime executable. I'm using the vcredist_x64.exe as opposed to the merge modules (see this thread). I can successfully launch the vcredist_x64.exe after my msi finishes installing my application by using a custom action... however, what I'd like to do is first check to see if the runtime files already exist. If they do, then I'll just finish without running the vcredist_x64.exe. Otherwise, I'll run the custom action to install the runtimes as well.

It took some digging, but I was able to find out that the 2015 runtimes have a registry key shown below:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64

with an Installed value of 1 if they exist.

So, in my .wxs file I have the following registry search:

<!-- Visual C++ 2015 x64 -->
<Property Id="VCREDISTRUNTIMES2015INSTALLED">
  <RegistrySearch Id="VCREDISTRUNTIMES2015SEARCH" Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" Name="Installed" Type="raw" />
</Property>

Now, what I'd like to do is show a message on my exit dialog which says that if the runtimes aren't detected, then it will launch an installer to install them upon exit. Something like this:

<Property Id="WIXUI_EXITDIALOGOPTIONALTEXT" Value="Visual C++ Redistributable for Visual Studio 2015 is Required. Installation will proceed on exit.">
  <Condition>VCREDISTRUNTIMES2015INSTALLED</Condition>
</Property>

However, this doesn't work. I get an error on the conditional tag and the project wont build. Assuming my registry search is setup correctly, can someone tell me how to properly add a conditional message on my exit dialog? Thanks!

Community
  • 1
  • 1
andyopayne
  • 1,348
  • 3
  • 24
  • 49
  • If you go this way (I'd use a WiX bootstrapper instead), make sure that the following scenario doesn't result in reinstalling the VC runtime. 1) Install your app. 2) Uninstall VC runtime. 3) Uninstall your app. – Tom Blodget Jan 19 '16 at 01:35
  • @TomBlodget I see what you're saying. but, I tried your use case and it still seems to work fine. If I install my app (with VC runtime), then uninstall the VC runtime, and then uninstall my app... it doesn't re-launch the the VC runtime installer on uninstall. I kind of expected that it would, but it just uninstalled my app, and that was all. – andyopayne Jan 19 '16 at 13:38

1 Answers1

2

Answering my own question... but here goes. It turns out that my registry search was just fine... but I needed to use "SetProperty" instead. So, something like this:

<SetProperty Id="WIXUI_EXITDIALOGOPTIONALTEXT" After="AppSearch" Value="The Visual C++ Redistributable Package for Visual Studio 2015 is Required. Installation will now install run-time components that are required to run C++ applications built using Visual Studio 2015.">
  NOT VCREDISTRUNTIMES2015INSTALLED
</SetProperty>

Now, if the VCREDISTRUNTIMES2015INSTALLED is null (or false) then it will show the message on the exit dialog. Otherwise, there will be no message shown. Hope that helps.

andyopayne
  • 1,348
  • 3
  • 24
  • 49