27245

WiX Bootstrapper - difficulty detecting if software is already installed C++ redistributable, SQL Se

So far (thanks to a post from Rob Mensching), my code will detect .NET 4.0 if it's installed, and it'll pass right over it. I'm not able to correctly detect Microsoft Visual C++ 2010 x86 Redistributable OR Microsoft SQL Server Compact 3.5 Service Pack 2.

My code is below. I'm learning, so I would appreciate as much constructive criticism as possible.

<!-- Search for .NET 4.0 --> <util:RegistrySearch Id="NETFRAMEWORK40" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Install" Variable="NETFRAMEWORK40" Result="value"/> <!-- Search for Microsoft Visual C++ 2010 x86 Redistributable --> <util:RegistrySearch Id="SearchForCPP2010X86" Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Value="Install" Variable="CPP2010Redist" Result="exists"/> <!-- Search for Microsoft SQL Server Compact 3.5 Service Pack 2 --> <util:RegistrySearch Id="SearchForSQLSvrCE35SP2" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU" Value="Install" Variable="SQLSvrCE35SP2" Result="exists"/> <Chain> <!-- Install .NET 4 Full --> <PackageGroupRef Id="Net4Full"/> <!-- Install Microsoft Visual C++ 2010 x86 Redistributable --> <PackageGroupRef Id="MSVisCPP2010x86Redist"/> <!-- Install Microsoft SQL Server Compact 3.5 Service Pack 2 --> <PackageGroupRef Id="SQLExpressCE"/> </Chain> <!-- Install .NET 4.0 --> <PackageGroup Id="Net4Full"> <ExePackage Id="Net4Full" Name="Microsoft .NET Framework 4.0 Setup" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" SourceFile="BootstrapperLibrary\dotNetFx40_Full_setup.exe" DetectCondition="NETFRAMEWORK40"/> </PackageGroup> <!-- Install Microsoft Visual C++ 2010 x86 Redistributable --> <PackageGroup Id="MSVisCPP2010x86Redist"> <ExePackage Id="MSVisCPP2010x86Redis" Name="Microsoft Visual C++ 2010 x86 Redistributable " Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" SourceFile="BootstrapperLibrary\vcredist_x86.exe" DetectCondition="CPP2010Redist"/> </PackageGroup> <!-- Install Microsoft SQL Server Compact 3.5 Service Pack 2 --> <PackageGroup Id="SQLExpressCE"> <ExePackage Id="SQLExpressCE" Name="Microsoft SQL Server Compact 3.5 Service Pack 2 Setup" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" SourceFile="BootstrapperLibrary\SSCERuntime-ENU.exe"/> </PackageGroup>

Answer1:

I was able to come up with the following solution. It's not ideal, but it works for now. We were given a very short amount of time to come up with something, so this is what "works" for now.

I had to go back to the documentation several more times and eventually discovered what I needed and what I was doing wrong. Again, this is an "it works sort of" solution to my problem.

WiX manual

WiX tutorial

I was also able to get a copy of the book "WiX 3.6: A Developer's Guide to Windows Installer XML" which proved to be useful. It would have been extremely useful, had it been available from day one.

My only complaint with the online WiX tutorial is that it does not have a copy (that I could find) that is based here in the US. I had to submit a request to have the website approved through our network security department. I now have access, but I had to wait a day to utilize it. When you're on a very tight development cycle, one day is a big deal.

Originally, part of my story was to search for both the 32- and 64-bit versions of SQL Server CE. I had a little trouble with the 64-bit version and ran out of time, so I used the attached file to download both the 32- and 64-bit installation files when applicable.

<!--Search for .NET 4.0--> <util:RegistrySearch Id="NETFRAMEWORK40" Root="HKLM" Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full" Value="Install" Variable="NETFRAMEWORK40" Result="value"/> <!--Search for Microsoft Visual C++ 2010 x86 Redistributable--> <util:RegistrySearch Root="HKLM" Key="SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" Variable="CPP2010Redist" Value="Installed" Result="value"/> <!--Search for Microsoft SQL Server Compact 3.5 Service Pack 2 x86--> <util:RegistrySearch Id="SqlCeRegistryx86" Root="HKLM" Key="SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU" Variable="SQLSvrCE35SP2x86" Win64="no" Result="exists"/> <Chain> <!-- Install .Net 4 Full --> <PackageGroupRef Id="Net4Full"/> <!-- Install Microsoft Visual C++ 2010 x86 Redistributable --> <PackageGroupRef Id="MSVisCPP2010x86Redist"/> <!-- Install Microsoft SQL Server Compact 3.5 Service Pack 2 x86 --> <PackageGroupRef Id="SQLExpressCEx86"/> </Chain> <Fragment Id="Prerequisites"> <!--.NET 4.0--> <PackageGroup Id="Net4Full"> <ExePackage Id="Net4Full" Cache="no" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes" SourceFile="BootstrapperLibrary\dotNetFx40_Full_setup.exe" DetectCondition="NETFRAMEWORK40"/> </PackageGroup> <!--Microsoft Visual C++ 2010 x86 Redistributable--> <PackageGroup Id="MSVisCPP2010x86Redist"> <ExePackage Id="MSVisCPP2010x86Redist" Cache="no" Compressed="yes" PerMachine="yes" Vital="yes" SourceFile="BootstrapperLibrary\vcredist_x86.exe" DetectCondition="CPP2010Redist"/> </PackageGroup> <!--Microsoft SQL Server Compact 3.5 Service Pack 2 x86--> <PackageGroup Id="SQLExpressCEx86"> <ExePackage Id="SQLExpressCEx86" Cache="no" Compressed="yes" PerMachine="yes" Vital="yes" SourceFile="BootstrapperLibrary\SSCERuntime-ENU.exe" DetectCondition="SQLSvrCE35SP2x86"/> </PackageGroup>

Answer2:

Surely, detection is the job of the redistributable. I would only try to reproduce it myself if the redistributable was known to have scenarios with undesirable behaviors (that is, is broken). Even then I would look for official documentation first.

Microsoft's Aaron Stebner's say in his personal blog:

Overall, my recommendation for the VC++ redistributable packages is to not bother to try to detect if the package is already installed. Instead, I recommend that you always install them during your installation process.

Your installer's declared goal is for the end state of VC 2010 runtime libraries to be functional at a certain service pack level. It communicates this goal to the redistributable, and it (hopefully) achieves it efficiently through whatever installation and/or repair process it deems necessary.

The key things to get right in an ExePackage are the InstallCommand and ExitCodes. Ideally, these would be officially documented. Exit codes are somewhat standardized to indicate failure, success with reboot required now, success with now reboot required (see the first note).

Recommend

  • Burn installer facing error .Net 45 0x80091007-The hash value is not correct
  • Relative path for SQLite not working with WIX Toolset
  • What's the difference with crf and qp in ffmpeg?
  • Possible to use CodeIgniter output compression with to display code blocks?
  • Unity iOS Build size is way big
  • RewriteCond and RewriteRule in .htaccess
  • Why isn't my mobile website auto-resizing for mobile devices?
  • Google Server gives a server error with the first request in private browsing mode
  • Can you actually link constraints to utterly different view controllers?
  • How to define the EclipseLink annotation for the following?
  • AVAudioPlayer - Why is there a gap between loops (uncompressed audio)
  • What's included in the “Initialization time” in the Symfony2 web profiler?
  • how to parse HTTP POST(file upload) stream?
  • Restrict calls to WCF service per minute, per method, per IP
  • TextBox controls are not Working with Export To PDF(iTextSharp)
  • How to add new collection criteria in Plone 5?
  • SessionHandler::gc(): ps_files_cleanup_dir | Permission denied (13)
  • How to check for connectivity with server using javaScript from native Android 2.1 browser?
  • Dagger2 where inject @Named @Provides in dependent module?
  • Multiplying column elements of sparse Matrix
  • How to create a dollar amount input field in an HTML form?
  • Referencing external dependencies in GGTS by convention
  • NullPointerException for lwuit.html.CSSEngine.applyStyleToUIElement(Unknown Source)
  • Delete ARP entry on Windows CE 6.0 CF.NET 2.0
  • Setting up ElastiCache Redis with Elastic BeanStalk + Django
  • Changing the user agent in Chromium Embedded 3 (DCEF3) (CefVCL)
  • JUnit 4.12: testing util classes
  • Will a method annotated with @PostConstruct be guaranteed to execute prior to a method with @Schedul
  • Delphi Chromium Embedded - Clear browser cache
  • Best GAC Tutorial/Overview? [closed]
  • how to bypass pinentry (passphrase screen) while decrypting a file using gpgme
  • joomla! 1.5.26 and “You are currently logged in to the private area of this site”
  • Persistent stty Settings?
  • Iterate twice through a DataReader
  • Changing Jupyter Notebook start up folder by modifying “start in” not working any more
  • NSIS decompiler
  • Universal Image Loader reuse images
  • HttpClient: disabling chunked encoding
  • Clear fused location provider's location for testing
  • android.support.v7.widget.Toolbar VectorDrawableCompat IllegalStateException when using support lib