Previous installation of my product was done in Visual Studio 2008 as deployment project (vdproj). User had the option to install per user (just me) or per machine (everyone). I'm doing new installation in WiX, and if product was installed per machine then new installation will uninstall previous version. BUT, if product was installed per user in %ProgramFiles% then new installation will not uninstall previous, making a mess of two installations in the same folder.
I want to detect and stop the installation in this situation. No automatic uninstall, just detect and stop. The solution should handle the case if one user did previous per user installation, and another user is doing new per machine. I thought DirectorySearch
and FileSearch
elements could be used, but they run before target folder is determined in UI.
If WiX code is involved please provide small example. I'll learn from it.
EDIT: If I add a property using AppSearch features DirectorySearch
and FileSearch
, and then check a condition with Condition
element this would check the condition at installation startup. This is not what I want. The user may change the target folder, so I need to check the existence of files in target folder in some step after the target folder can no longer be changed.
In my naivety I also tried to read the value of property mentioned in previous paragraph with SetProperty
in some custom action, but that does not work either. The value is read alright, but it's the value that was determined at the start of setup.
Proper solution should probably include the answer given to another question. I'm currently toying with JScript, as per tip given in WiX tricks community wiki. Will probably make it a .dll to avoid anti-virus meddling, mentioned in Rob Mensching's blog post.