WIX dynamically set install path according to registry key - wix

I am using WIX to generate an MSI to install an application. I want the application to be installed in a subfolder of a previously installed application. The issue is that the path for this previously installed application can be changed at install time (the UI provides a directory selection dialog); the path is however saved in a registry key. How can I get the value of this registry key and use it as TARGETDIR value for my new application?

I'd use a ComponentSearch and set the result in TARGETDIR using a custom action.

You should take a look at the RegistrySearch element. And by the way, this paragraph of the WiX tutorial describes the approach you should follow in such situations.
Hope this helps.

Related

Wix Bootstrapper: Rules to follow for burn to be cached

I am trying to find any information how the Windows installer cache is working for Wix Bootstrappers.
For MSIs you do not follow any special rules to be sure a MSI will be cached by Windows. For Bootstrappers (Burns) it looks the same, but I had several issues trying to uninstall the package without original installer.
For me several points are not clear:
how to uninstall a product without original .exe installer?
will .exe installer be cached by default during installation?
does custom user interface affects Windows caching rules for .exe installers?
If you go into your registry and find "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall", you should be able to find a registry key corresponding to your installer package. There should be one for the bundle itself and one for each .msi installed as part of the bundle. If you find the correct key for the bundle, it will have a value called "UninstallString". This is the string you should use to manually uninstall the package via the command line.
For your second point, Windows automatically caches installed burn bundles. The same registry key you found in the step above will have another value called "BundleCachePath", which should point you to the location of the cached .exe file. This should be under "C:\ProgramData\PackageCache{GUID}", where {GUID} is the package GUID of the bundle.
I can't see why having a custom UI would change the caching location, unless you manually add a dialogue to do so.

Wix Burn Loose File Install

Copying of license files using Wix 3.10.2? We have a requirement where we need copy some license files after the installation of the webapplication to IIS. Copying of license files will be the last in the sequence. The license files will reside next to the burn (bootstrapper) setup.exe. This way we can control what license file need to be installed based on the user. I am trying to understand if there will be an issue with number of license files reside along with .exe? Is there a custom action to pick files that are not part of the msi or exe?
1) There will not be an issue with number of license files residing along with exe
2) Using the Media element without a Cabinet name you can specify that certain files will neither be inside a cab or embedded into the msi, no custom action needed. See http://wixtoolset.org/documentation/manual/v3/xsd/wix/media.html
You may need to be more precise about exactly when you want the copy to occur. Your original question says "after the installation" which implies that the install has finished and that your generated MSI is no longer running. but in a later comment you say "during the install".
If after the install is what you want, then you could add a custom executable to your Burn bundle that will do whatever you want. In many of these kinds of situations the application that needs the file just goes and gets it with help from the MSI saying where it was installed from, or by using the SourceList capabilities of Windows Installer to get the location.
If you want to copy files during the install then the CopyFile element is probably what you need. It has wildcard capability to define the files you want to copy. Your source location will be the SourceDir property and the destination will be one of your defined directories. Note that the files will not be uninstalled when the product is uninstalled.
WiX Copyfile:
http://wixtoolset.org/documentation/manual/v3/xsd/wix/copyfile.html
I had to use native bootstrap that comes with Visual Studio SDK. With the bootstrap you can also create pre-requisite like installing .net. This worked for my requirement. Also there is a msbuild task so that you can automate it. Used setup project to create msi and VS bootstrap to create setup.exe

Run WIX installer package in a non-User mode and Provide answer file to a WIX installation package

it is possible to install wix installer in non user mode and it take the input from the answer file this is the screen
answer file will put the Server name and data base name.
<serverName>localhost\SqlExpress</serverName><databaseName></databaseName>
This is the my answer file
Windows Installer does not have a facility for answer files. Instead, automated behavior is provided through property settings.
The primary way to set properties for an installer operation is via the msiexec command-line. You would probably want to use one of the quiet/unattended modes, too.
Another way, since an MSI file is a database, is to set properties in a copy of the MSI.

WiX MSI: Bundle a Demo Project with Installer

I'm trying to bundle a demo project with the WiX MSI installer for an application. My goal is to create a "Projects" folder that contains the "Demo Project" folder in the user's Documents directory.
Since my installation scope is "perMachine" adding files to a user directory results in the following error for each file:
It must use a registry key under HKCU as its KeyPath, not a file
I could fix this error by adding the RegistryValue element to each Component but, the demo project has at least 1000 files.
I was thinking about creating another installer for the demo project that would have a "perUser" install scope and then bundle that into a WiX bootstrapper. The only downside is that it feels like a hack.
What is a recommended method when installing complementary material for a application? Should I build another installer or is there a WiX extension that would allow me to copy files to the user's documents directory?
Because it's a demo project and not critical to your app, one approach is to zip it up and have that single zip file as the component. The potential issue with demo projects in your component-per-file case is that users will start fiddling around with the demo in some way and eventually Windows Installer will be prompted to repair it. This is especially true if the project is something that clients open with a dev tool and start changing. You don't want the demo interaction with a repair to impact your running app.
There isn't a WiX or MSI way to copy files to user's folders because that's actually what the Registry keypath is for. It also has the advantage of working for user accounts that haven't been created yet. When another user logs on and uses the app Windows notices that the keypath is missing for that user and that prompts installation of the key path component (the file) from the original install source.

WIX: How to detect if third-party application is installed?

Is it any way in WIX to detect that a third-party application with a specified upgrade code is installed and what is it's installation folder? I can suggest a custom action is required, but what exactly to do in such custom action? Is it possible to detect such things in VBS custom action?
It really depends on the application. Most applications publish a registry key that can be used to detect them. In that case you just need a RegistrySearch element, no custom actions necessary. If the application was installed via MSI, sometimes a ComponentSearch is better.
You can use dotNetInstaller for configure it very well. With the help of registry search you can easily find out that the program is installed or not(Use product version / Product name for additional check)