Search code examples
windowsinstallationwixwindows-installerwix3.11

When does burn for WiX toolset use C:\ProgramData\Package Cache\ vs C:\Users\...\AppData\Local\Package Cache?


I now encounter weird errors.

I have a bundle project (calling bundle A) that is perfectly working, and now I am working on a bundles that is created again from the bundle A. (calling this new bundle B)

Even though the prerequisite exe has not changed, nor the <ExePackage ...> code, error started to show up in the middle of installing the prerequisite for bundle B.

Error code itself are 0x800702e4, but I do not think the cause is elevation issue. I compared the binaries (using winmerge) and confirmed the exe are same.

Main difference I found in the bundle .log is the path the file is available.

In the bundle A, the path of this prerequisite was located in C:\ProgramData\Package Cache

However, in the bundle B the path of this prerequisite is placed at C:\Users\My.User.Name\AppData\Local\Package Cache

I recall the majority of the time ProgramData was used before. How could this happen? When does WiX determine to use different package locations? Is there a flag in the bundle code I can modify to guarantee the use of ProgramData?

EDIT

Just for the sake of trying, assuming it is elevation problem, I added <ExePackage PerMachine="yes"...> and this problem went away. Now the question becomes why did this work with bundle A?


Solution

  • It sounds like you have a package installed per user (Installation Context and properties: MSIINSTALLPERUSER, ALLUSERS). Then it probably caches in that per user location (user profile) you specified.

    Here is a quick scan of your package estate for per user installations. Just save to desktop and run (for example PackageScan.vbs). There will be a message box for each per user installation (if any):

    Dim installer : Set installer = CreateObject("WindowsInstaller.Installer")
    
    'On Error Resume Next
    
    Set products = installer.ProductsEx("", "", 7) 
       
    For Each product In products
       'productcode = product.ProductCode 
       name = product.InstallProperty("ProductName")
       'version = product.InstallProperty("VersionString") 
       assignment = product.InstallProperty("AssignmentType")
       
       If (assignment = 0) Then
          MsgBox "Found per user installation. The product name is: " & vbNewLine & vbNewLine & name
       End If
    Next
    
    'On Error GoTo 0
    
     Msgbox "Done."
    

    Here is a script to create a HTML export of the package estate. It does not have the above assignment information, but that is easy to add. Let me just add it. New version here.

    UPDATE: And here is the latest version as of 16.April.2021. Automatic highlighting of table cell content and translation of Scope integer to "Machine" or "User" installation.