I have a small application for which I made a wix 3 setup that installed it to the local AppData folder. This never required admin permissions and it worked flawlessly.
Recently I upgraded to Wix 4. But now it started to ask for elevated permissions to install the setup. I added Scope="perUser" to it to avoid it from asking for elevated permissions, but now Setup fails with permissions errors on Non Admin user account. If I remove <PackageGroupRef Id="NetFx462Redist" /> it works fine.
Error 0x80070005: Failed to secure cache path: C:\ProgramData\Package Cache
Error 0x80070005: Failed to secure cache directory: C:\ProgramData\Package Cache
Error 0x80070005: Failed to secure per-machine cache root. Failed to prepare package: NetFx462Redist, error: 0x80070005
Error 0x80070005: Cache prepare package failed: NetFx462Redist
Error 0x80070005: Failed while caching, aborting execution.
Why is this happening and how can I avoid that?
Error log:
[1230:3BD8][2024-03-20T18:11:55]i001: Burn x64 v4.0.1+6e6eb47812742cfb61a1c3328ba662ec2886a4e2, Windows v10.0 x64 (Build 19045: Service Pack 0), path: F:\Users\dev\AppData\Local\Temp\{9550C09D-EF64-4F2F-8C91-6236A7915A91}\.cr\MyTestInstaller (2).exe
[1230:3BD8][2024-03-20T18:11:55]i000: Initializing formatted variable 'LaunchTarget' to value '[LocalAppDataFolder]\MyTest\MyTest.Launcher.exe'
[1230:3BD8][2024-03-20T18:11:55]i009: Command Line: '"-burn.clean.room=F:\Users\dev\Downloads\MyTestInstaller (2).exe" -burn.filehandle.attached=628 -burn.filehandle.self=668 /disablesystemrestore'
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'WixBundleOriginalSource' to value 'F:\Users\dev\Downloads\MyTestInstaller (2).exe'
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'WixBundleOriginalSourceFolder' to value 'F:\Users\dev\Downloads\'
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'WixBundleLog' to value 'F:\Users\dev\AppData\Local\Temp\MyTest_20240320181155.log'
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'WixBundleInProgressName' to value ''
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'WixBundleName' to value 'MyTest'
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'WixBundleManufacturer' to value 'MyTest'
[1230:28B0][2024-03-20T18:11:55]i000: Setting numeric variable 'WixStdBALanguageId' to value 1033
[1230:28B0][2024-03-20T18:11:55]i000: Setting version variable 'WixBundleFileVersion' to value '3.4.2.0'
[1230:3BD8][2024-03-20T18:11:55]i100: Detect begin, 2 packages
[1230:3BD8][2024-03-20T18:11:55]i000: Setting string variable 'NETFRAMEWORK45' to value '533325'
[1230:3BD8][2024-03-20T18:11:55]i052: Condition 'NETFRAMEWORK45 >= 394802' evaluates to true.
[1230:3BD8][2024-03-20T18:11:55]i101: Detected package: NetFx462Redist, state: Present, cached: Yes, install registration state: (permanent), cache registration state: (permanent)
[1230:3BD8][2024-03-20T18:11:55]i101: Detected package: SetupAdmin, state: Absent, cached: No, install registration state: Absent, cache registration state: Absent
[1230:3BD8][2024-03-20T18:11:55]i052: Condition '((VersionNT >= v5.1) AND (ServicePackLevel >= 3)) OR ((VersionNT >= v5.2) AND (ServicePackLevel >= 2)) OR ((VersionNT >= v6.1) AND (ServicePackLevel >= 1)) OR (VersionNT >= v6.2)' evaluates to true.
[1230:3BD8][2024-03-20T18:11:55]i199: Detect complete, result: 0x0, registration state: None, cached: No, eligible for cleanup: No
[1230:28B0][2024-03-20T18:11:55]i052: Condition 'WixStdBASuppressOptionsUI' evaluates to false.
[1230:28B0][2024-03-20T18:11:55]i052: Condition 'NOT WixStdBASuppressOptionsUI' evaluates to true.
[1230:28B0][2024-03-20T18:11:55]i052: Condition 'WixStdBAUpdateAvailable' evaluates to false.
[1230:3BD8][2024-03-20T18:11:57]i200: Plan begin, 2 packages, action: Install
[1230:3BD8][2024-03-20T18:11:57]w321: Skipping dependency registration on package with no dependency providers: NetFx462Redist
[1230:3BD8][2024-03-20T18:11:57]i000: Setting string variable 'WixBundleRollbackLog_SetupAdmin' to value 'F:\Users\dev\AppData\Local\Temp\MyTest_20240320181155_000_SetupAdmin_rollback.log'
[1230:3BD8][2024-03-20T18:11:57]i000: Setting string variable 'WixBundleLog_SetupAdmin' to value 'F:\Users\dev\AppData\Local\Temp\MyTest_20240320181155_000_SetupAdmin.log'
[1230:3BD8][2024-03-20T18:11:57]i222: Planned rollback boundary: 'WixDefaultBoundary', vital: Yes, transaction: No (default: No)
[1230:3BD8][2024-03-20T18:11:57]i201: Planned package: NetFx462Redist, state: Present, default requested: Present, ba requested: Present, execute: None, rollback: None, default cache strategy: Keep, ba requested strategy: Keep, cache: Vital, uncache: No, dependency: None, expected install registration state: (permanent), expected cache registration state: (permanent)
[1230:3BD8][2024-03-20T18:11:57]i222: Planned rollback boundary: 'rbaJA7dgpho1pultPTYcYcDOX4pBMc', vital: Yes, transaction: No (default: No)
[1230:3BD8][2024-03-20T18:11:57]i201: Planned package: SetupAdmin, state: Absent, default requested: Present, ba requested: Present, execute: Install, rollback: Uninstall, default cache strategy: Keep, ba requested strategy: Keep, cache: Vital, uncache: No, dependency: Register, expected install registration state: Present, expected cache registration state: Present
[1230:3BD8][2024-03-20T18:11:57]i299: Plan complete, result: 0x0
[1230:3BD8][2024-03-20T18:11:58]i300: Apply begin
[1230:3BD8][2024-03-20T18:11:58]i370: Session begin, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}, options: 0x3, disable resume: No
[1230:3BD8][2024-03-20T18:11:58]i000: Caching bundle from: 'F:\Users\dev\AppData\Local\Temp\{556DB09D-821D-425C-87D7-217A8C9BE73C}\.be\MyTestInstaller.exe' to: 'F:\Users\dev\AppData\Local\Package Cache\{B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}\MyTestInstaller.exe'
[1230:3BD8][2024-03-20T18:11:58]i320: Registering bundle dependency provider: {B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}, version: 3.4.2
[1230:3BD8][2024-03-20T18:11:58]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}, resume: Active, restart initiated: No, disable resume: No
[1230:0A0C][2024-03-20T18:12:04]e000: Error 0x80070005: Failed to secure cache path: F:\ProgramData\Package Cache\
[1230:0A0C][2024-03-20T18:12:04]e000: Error 0x80070005: Failed to secure cache directory: F:\ProgramData\Package Cache\
[1230:0A0C][2024-03-20T18:12:04]e000: Error 0x80070005: Failed to secure per-machine cache root.
[1230:0A0C][2024-03-20T18:12:04]e337: Failed to prepare package: NetFx462Redist, error: 0x80070005
[1230:0A0C][2024-03-20T18:12:04]e000: Error 0x80070005: Cache prepare package failed: NetFx462Redist
[1230:3BD8][2024-03-20T18:12:04]e000: Error 0x80070005: Failed while caching, aborting execution.
[1230:3BD8][2024-03-20T18:12:04]i373: Calculating whether to keep registration
[1230:3BD8][2024-03-20T18:12:04]i374: package: NetFx462Redist, install registration state: (permanent), cache registration state: (permanent)
[1230:3BD8][2024-03-20T18:12:04]i374: package: SetupAdmin, install registration state: Absent, cache registration state: Absent
[1230:3BD8][2024-03-20T18:12:04]i372: Session end, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}, resume: None, restart: None, disable resume: No, default registration: None, ba requested registration: None
[1230:3BD8][2024-03-20T18:12:04]i330: Removed bundle dependency provider: {B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}
[1230:3BD8][2024-03-20T18:12:04]i326: Removed dependency: {B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D} on package provider: {D5B299E0-3EB0-4A2C-A450-D5DF6CF5AD88}_v3.4.2, package SetupAdmin
[1230:3BD8][2024-03-20T18:12:04]i329: Removed package dependency provider: {D5B299E0-3EB0-4A2C-A450-D5DF6CF5AD88}_v3.4.2, package: SetupAdmin
[1230:3BD8][2024-03-20T18:12:04]i352: Removing cached bundle: {B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}, from path: F:\Users\dev\AppData\Local\Package Cache\{B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}\
[1230:3BD8][2024-03-20T18:12:04]i371: Updating session, registration key: SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{B4A8E23E-78D6-4B2A-A3A6-A41EDE859A7D}, resume: None, restart initiated: No, disable resume: No
[1230:3BD8][2024-03-20T18:12:04]i000: Unsetting variable 'WixStdBARestartRequired'
[1230:3BD8][2024-03-20T18:12:04]i399: Apply complete, result: 0x80070005, restart: None, ba requested restart: No
[1230:28B0][2024-03-20T18:12:04]i052: Condition 'WixBundleAction = 2' evaluates to false.
[1230:28B0][2024-03-20T18:12:04]i052: Condition 'WixBundleAction = 3' evaluates to false.
[1230:28B0][2024-03-20T18:12:04]i052: Condition 'WixBundleAction = 4' evaluates to false.
[1230:28B0][2024-03-20T18:12:04]i052: Condition 'WixBundleAction = 5' evaluates to false.
[1230:28B0][2024-03-20T18:12:04]i052: Condition 'WixBundleAction = 6' evaluates to true.
[1230:28B0][2024-03-20T18:12:04]i052: Condition 'WixStdBARestartRequired' evaluates to false.
Here is my product.wxs
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<?include common.wxi ?>
<Package Name="$(var.PRODUCT) $(var.VERSION)" UpgradeCode="$(var.UPGRADECODE)" Language="1033" Codepage="1252" Version="$(var.VERSION)" Manufacturer="$(var.MANUFACTURER)" InstallerVersion="200" Scope="perUser">
<SummaryInformation Keywords="Installer, MSI, Package" Manufacturer="$(var.MANUFACTURER)" />
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="$(var.DOWNGRADEERRORMESSAGE)" />
<MediaTemplate EmbedCab="yes" />
<Property Id="ApplicationFolderName" Value="$(var.MANUFACTURER)\$(var.PRODUCT)" />
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="INSTALLDIRComponent" />
</Feature>
<StandardDirectory Id="LocalAppDataFolder">
<Directory Id="INSTALLDIR" Name="MyApp">
<Component Id="INSTALLDIRComponent" Guid="$(var.INSTALLDIRGUID)" Bitness="always64">
<File Id="___var_MyApp.exe" Source="$(var.MyApp.TargetDir)MyApp.exe" />
<File Id="mainExecutableFile" Source="$(var.MyApp.TargetDir)MyApp.Launcher.exe" />
<RegistryValue Root="HKCU" Key="Software\MyApp\MyApp" Name="Exe" Value="[INSTALLDIR]MyApp.exe" Type="string" />
<RegistryValue Root="HKCU" Key="Software\MyApp\MyApp" Name="Path" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
<RemoveFolder Id="INSTALLDIRfolder" Directory="INSTALLDIR" On="uninstall" />
</Component>
</Directory>
</StandardDirectory>
</Package>
</Wix>
And Bundle.wxs
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Bundle Name="MyApp" Version="$(var.Version)" Manufacturer="MyApp" UpgradeCode="97baf4b4-4e07-43bb-9042-df6bf3e29f6e">
<bal:Condition Message="You’re using an unsupported version of Windows. MyApp requires Windows 7 SP1 or later." Condition="((VersionNT >= v5.1) AND (ServicePackLevel >= 3)) OR ((VersionNT >= v5.2) AND (ServicePackLevel >= 2)) OR ((VersionNT >= v6.1) AND (ServicePackLevel >= 1)) OR (VersionNT >= v6.2)" />
<Variable Name="LaunchTarget" Value="[LocalAppDataFolder]\MyApp\MyApp.Launcher.exe" Type="formatted" />
<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication LogoFile="Resources/[email protected]" ThemeFile="Resources/ClassicTheme.xml" LocalizationFile="Resources/ClassicTheme.wxl" LicenseUrl="" Theme="hyperlinkSidebarLicense" />
</BootstrapperApplication>
<Chain DisableSystemRestore="yes">
<PackageGroupRef Id="NetFx462Redist" />
<RollbackBoundary />
<MsiPackage Id="SetupAdmin" Compressed="yes" SourceFile="$(var.MSIInstaller.TargetDir)MyApp.msi" Vital="yes">
<MsiProperty Name="INSTALLLOCATION" Value="[INSTALLDIR]" />
<MsiProperty Name="BUNDLEKEY" Value="[WixBundleProviderKey]" />
</MsiPackage>
</Chain>
</Bundle>
</Wix>