Winget acting strange after moving package cache and temp to Dev-Drive
Brief description of your issue
After moving the package cache and temporary directories to a Dev-Drive, winget list displays packages with unusual prefixes such as MSIX/ or ARP/. This behavior did not occur before the change.
Additionally, updating or working these packages with prefixes seems impossible. It only affects the packages that were deployed by default during the Windows 11 installation.
VS Code, for example, was install after the Dev-Drive was setup and seems to work correctly:
Microsoft Visual Studio Code (User) XP9KHM4BK9FZ7Q
However, Intel Graphics Command Center, for example, does update or not work correctly. I believe Intel Graphics Command Center was installed by Windows automatically.
Intel® Graphics Command Center MSIX\AppUp.IntelGraphicsExperience_1.100.5536.0_x64__8j3eq9eme6ctt
Below is the output on a fresh Win 11 install.
> winget list
Name Id Version Available Source
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Microsoft OneDrive Microsoft.OneDrive 22.012.0117.0003 24.116.0609.0005 winget
NVIDIA Graphics Driver 456.71 ARP\Machine\X64\{B2FE1952-0186-46C3-BAEC-A80AA35AC5B8}_Display.Driver 456.71
Microsoft Update Health Tools ARP\Machine\X64\{C6FD611E-7EFE-488C-A0E0-974C09EF6473} 5.72.0.0
Microsoft Edge Microsoft.Edge 126.0.2592.87 winget
Microsoft Edge Update ARP\Machine\X86\Microsoft Edge Update 1.3.187.41
Microsoft Edge WebView2 Runtime Microsoft.EdgeWebView2Runtime 126.0.2592.87 winget
vs_CoreEditorFonts ARP\Machine\X86\{1851460E-0E63-4117-B5BA-25A2F045801B} 17.7.40001
Realtek High Definition Audio Driver ARP\Machine\X86\{F132AF7F-7BCA-4EDE-8A7C-958108FE7DBC} 6.0.1.8308
Microsoft Visual Studio Code (User) XP9KHM4BK9FZ7Q 1.91.0 msstore
Intel® Graphics Command Center MSIX\AppUp.IntelGraphicsExperience_1.100.5536.0_x64__8j3eq9eme6ctt 1.100.5536.0
Microsoft Clipchamp MSIX\Clipchamp.Clipchamp_3.1.10620.0_neutral__yxz26nhyzhsrt 3.1.10620.0
Cortana MSIX\Microsoft.549981C3F5F10_4.2308.1005.0_x64__8wekyb3d8bbwe 4.2308.1005.0
News MSIX\Microsoft.BingNews_4.55.62231.0_x64__8wekyb3d8bbwe 4.55.62231.0
MSN Weather MSIX\Microsoft.BingWeather_4.53.61401.0_x64__8wekyb3d8bbwe 4.53.61401.0
App Installer Microsoft.AppInstaller 1.23.1791.0 winget
Xbox MSIX\Microsoft.GamingApp_2406.1001.20.0_x64__8wekyb3d8bbwe 2406.1001.20.0
Get Help MSIX\Microsoft.GetHelp_10.2403.20861.0_x64__8wekyb3d8bbwe 10.2403.20861.0
Microsoft Tips MSIX\Microsoft.Getstarted_10.2312.1.0_x64__8wekyb3d8bbwe 10.2312.1.0
HEIF Image Extensions MSIX\Microsoft.HEIFImageExtension_1.1.861.0_x64__8wekyb3d8bbwe 1.1.861.0
HEVC Video Extensions from Device Manufacturer MSIX\Microsoft.HEVCVideoExtension_2.1.1803.0_x64__8wekyb3d8bbwe 2.1.1803.0
Microsoft Edge MSIX\Microsoft.MicrosoftEdge.Stable_126.0.2592.87_neutral__8wekyb3d8… 126.0.2592.87
Microsoft 365 (Office) MSIX\Microsoft.MicrosoftOfficeHub_18.2405.1221.0_x64__8wekyb3d8bbwe 18.2405.1221.0
Solitaire & Casual Games MSIX\Microsoft.MicrosoftSolitaireCollection_4.20.6270.0_x64__8wekyb3… 4.20.6270.0
Microsoft Sticky Notes MSIX\Microsoft.MicrosoftStickyNotes_4.0.6102.0_x64__8wekyb3d8bbwe 4.0.6102.0
Microsoft .Net Native Framework Package 2.2 MSIX\Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x64__8wekyb3d8bb… 2.2.29512.0
Microsoft .Net Native Framework Package 2.2 MSIX\Microsoft.NET.Native.Framework.2.2_2.2.29512.0_x86__8wekyb3d8bb… 2.2.29512.0
Microsoft .Net Native Runtime Package 2.2 MSIX\Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x64__8wekyb3d8bbwe 2.2.28604.0
Microsoft .Net Native Runtime Package 2.2 MSIX\Microsoft.NET.Native.Runtime.2.2_2.2.28604.0_x86__8wekyb3d8bbwe 2.2.28604.0
Outlook for Windows MSIX\Microsoft.OutlookForWindows_1.2024.625.600_x64__8wekyb3d8bbwe 1.2024.625.600
Paint MSIX\Microsoft.Paint_11.2404.1020.0_x64__8wekyb3d8bbwe 11.2404.1020.0
Microsoft People MSIX\Microsoft.People_10.2202.100.0_x64__8wekyb3d8bbwe 10.2202.100.0
Power Automate MSIX\Microsoft.PowerAutomateDesktop_1.0.1225.0_x64__8wekyb3d8bbwe 1.0.1225.0
PowerShell MSIX\Microsoft.PowerShell_7.4.3.0_x64__8wekyb3d8bbwe 7.4.3.0
Raw Image Extension MSIX\Microsoft.RawImageExtension_2.3.1221.0_x64__8wekyb3d8bbwe 2.3.1221.0
Snipping Tool MSIX\Microsoft.ScreenSketch_11.2405.32.0_x64__8wekyb3d8bbwe 11.2405.32.0
Windows Security MSIX\Microsoft.SecHealthUI_1000.25992.9000.0_x64__8wekyb3d8bbwe 1000.25992.9000.0
Microsoft Engagement Framework MSIX\Microsoft.Services.Store.Engagement_10.0.23012.0_x64__8wekyb3d8… 10.0.23012.0
Microsoft Engagement Framework MSIX\Microsoft.Services.Store.Engagement_10.0.23012.0_x86__8wekyb3d8… 10.0.23012.0
Store Experience Host MSIX\Microsoft.StorePurchaseApp_22403.1401.1.0_x64__8wekyb3d8bbwe 22403.1401.1.0
Microsoft To Do MSIX\Microsoft.Todos_0.114.7122.0_x64__8wekyb3d8bbwe 0.114.7122.0
Microsoft.UI.Xaml.2.7 Microsoft.UI.Xaml.2.7 7.2208.15002.0 winget
Microsoft.UI.Xaml.2.7 Microsoft.UI.Xaml.2.7 7.2208.15002.0 winget
Microsoft.UI.Xaml.2.8 Microsoft.UI.Xaml.2.8 8.2310.30001.0 winget
Microsoft.UI.Xaml.2.8 Microsoft.UI.Xaml.2.8 8.2310.30001.0 winget
Microsoft Visual C++ 2015 UWP Desktop Runtime Package Microsoft.VCLibs.Desktop.14 14.0.33728.0 winget
Microsoft Visual C++ 2015 UWP Desktop Runtime Package Microsoft.VCLibs.Desktop.14 14.0.33728.0 winget
Microsoft Visual C++ 2015 UWP Runtime Package MSIX\Microsoft.VCLibs.140.00_14.0.30704.0_x64__8wekyb3d8bbwe 14.0.30704.0
Microsoft Visual C++ 2015 UWP Runtime Package MSIX\Microsoft.VCLibs.140.00_14.0.33519.0_x64__8wekyb3d8bbwe 14.0.33519.0
Microsoft Visual C++ 2015 UWP Runtime Package MSIX\Microsoft.VCLibs.140.00_14.0.33519.0_x86__8wekyb3d8bbwe 14.0.33519.0
VP9 Video Extensions MSIX\Microsoft.VP9VideoExtensions_1.1.451.0_x64__8wekyb3d8bbwe 1.1.451.0
Web Media Extensions MSIX\Microsoft.WebMediaExtensions_1.1.1295.0_x64__8wekyb3d8bbwe 1.1.1295.0
Webp Image Extensions MSIX\Microsoft.WebpImageExtension_1.1.1711.0_x64__8wekyb3d8bbwe 1.1.1711.0
Dev Home Microsoft.DevHome 0.1500.533.0 0.1501.533.0 winget
Microsoft Photos MSIX\Microsoft.Windows.Photos_2024.11070.3017.0_x64__8wekyb3d8bbwe 2024.11070.3017.0
Windows Clock MSIX\Microsoft.WindowsAlarms_1.0.191.0_x64__8wekyb3d8bbwe 1.0.191.0
WindowsAppRuntime.1.2 MSIX\Microsoft.WindowsAppRuntime.1.2_2000.802.31.0_x64__8wekyb3d8bbwe 2000.802.31.0
WindowsAppRuntime.1.2 MSIX\Microsoft.WindowsAppRuntime.1.2_2000.802.31.0_x86__8wekyb3d8bbwe 2000.802.31.0
WindowsAppRuntime.1.3 MSIX\Microsoft.WindowsAppRuntime.1.3_3000.934.1904.0_x64__8wekyb3d8b… 3000.934.1904.0
WindowsAppRuntime.1.3 MSIX\Microsoft.WindowsAppRuntime.1.3_3000.934.1904.0_x86__8wekyb3d8b… 3000.934.1904.0
WindowsAppRuntime.1.4 MSIX\Microsoft.WindowsAppRuntime.1.4_4000.1227.1637.0_x64__8wekyb3d8… 4000.1227.1637.0
WindowsAppRuntime.1.4 MSIX\Microsoft.WindowsAppRuntime.1.4_4000.1227.1637.0_x86__8wekyb3d8… 4000.1227.1637.0
WindowsAppRuntime.1.5 MSIX\Microsoft.WindowsAppRuntime.1.5_5001.159.55.0_x64__8wekyb3d8bbwe 5001.159.55.0
WindowsAppRuntime.1.5 MSIX\Microsoft.WindowsAppRuntime.1.5_5001.159.55.0_x86__8wekyb3d8bbwe 5001.159.55.0
Windows Calculator MSIX\Microsoft.WindowsCalculator_11.2405.2.0_x64__8wekyb3d8bbwe 11.2405.2.0
Windows Camera MSIX\Microsoft.WindowsCamera_2024.2405.19.0_x64__8wekyb3d8bbwe 2024.2405.19.0
Feedback Hub MSIX\Microsoft.WindowsFeedbackHub_1.2405.21481.0_x64__8wekyb3d8bbwe 1.2405.21481.0
Windows Maps MSIX\Microsoft.WindowsMaps_1.0.62.0_x64__8wekyb3d8bbwe 1.0.62.0
Windows Notepad MSIX\Microsoft.WindowsNotepad_11.2405.13.0_x64__8wekyb3d8bbwe 11.2405.13.0
Windows Sound Recorder MSIX\Microsoft.WindowsSoundRecorder_1.0.78.0_x64__8wekyb3d8bbwe 1.0.78.0
Microsoft Store MSIX\Microsoft.WindowsStore_22405.1401.9.0_x64__8wekyb3d8bbwe 22405.1401.9.0
Windows Terminal Microsoft.WindowsTerminal 1.20.11381.0 1.20.11781.0 winget
Windows Package Manager Source (winget) MSIX\Microsoft.Winget.Source_2024.706.516.19_neutral__8wekyb3d8bbwe 2024.706.516.19
Xbox TCUI MSIX\Microsoft.Xbox.TCUI_1.24.10001.0_x64__8wekyb3d8bbwe 1.24.10001.0
Xbox Game Bar Plugin MSIX\Microsoft.XboxGameOverlay_1.54.4001.0_x64__8wekyb3d8bbwe 1.54.4001.0
Game Bar MSIX\Microsoft.XboxGamingOverlay_7.124.5142.0_x64__8wekyb3d8bbwe 7.124.5142.0
Xbox Identity Provider MSIX\Microsoft.XboxIdentityProvider_12.113.31003.0_x64__8wekyb3d8bbwe 12.113.31003.0
Xbox Game Speech Window MSIX\Microsoft.XboxSpeechToTextOverlay_1.21.13002.0_x64__8wekyb3d8bb… 1.21.13002.0
Phone Link MSIX\Microsoft.YourPhone_0.24061.93.0_x64__8wekyb3d8bbwe 0.24061.93.0
Windows Media Player MSIX\Microsoft.ZuneMusic_11.2405.8.0_x64__8wekyb3d8bbwe 11.2405.8.0
Movies & TV MSIX\Microsoft.ZuneVideo_10.22091.10061.0_x64__8wekyb3d8bbwe 10.22091.10061.0
Quick Assist MSIX\MicrosoftCorporationII.QuickAssist_2.0.30.0_x64__8wekyb3d8bbwe 2.0.30.0
Windows Web Experience Pack MSIX\MicrosoftWindows.Client.WebExperience_524.13200.30.0_x64__cw5n1… 524.13200.30.0
Mail and Calendar MSIX\microsoft.windowscommunicationsapps_16005.14326.21970.0_x64__8w… 16005.14326.2197…
Steps to reproduce
- Move the Winget package cache and temporary directories to a Dev-Drive.
- Run winget list.
Expected behavior
winget list should display a list of installed packages without unusual prefixes and should allow for updating these packages.
Actual behavior
winget list shows some packages with prefixes like MSIX/ or ARP/ (something I haven't seen before), and these packages cannot be updated.
Environment
> winget --info
Windows Package Manager v1.8.1791
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.22631.3810
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1791.0
Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User) %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root C:\Program Files\WinGet\Packages
Portable Package Root (x86) C:\Program Files (x86)\WinGet\Packages
Installer Downloads %USERPROFILE%\Downloads
Links
---------------------------------------------------------------------------
Privacy Statement https://aka.ms/winget-privacy
License Agreement https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
Admin Setting State
--------------------------------------------------
LocalManifestFiles Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride Disabled
LocalArchiveMalwareScanOverride Disabled
ProxyCommandLineOptions Disabled
DefaultProxy Disabled
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Open similar issues:
- winget losing track of progress (#4396), similarity score: 0.78
Closed similar issues:
- WinGetUI not displaying updates or installed packages but winget cli works (#3908), similarity score: 0.81
- winget upgrade --accept-source-agreement list all packages even if new version isn't available (#1869), similarity score: 0.79
- winget upgrade --all does not work anymore (#4261), similarity score: 0.78
- Can't show installed app list and can't do upgrade --all (#2016), similarity score: 0.78
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
What steps did you take to move the cache and temporary directories to a Dev Drive?
I don't think this has anything to do with the Dev Drive, but instead it just happened to coincide with an update to winget.
The packages with ARP\ or MSIX\ prefixes are the ones for which winget did not find a matching package in the source and we just list what is installed on the machine. You should be able to uninstall it with winget using that ID (use \ instead of /), but you cannot update it because winget does not have any information about available versions for it.
What steps did you take to move the cache and temporary directories to a Dev Drive?
@denelon Thanks for getting back to me. I followed what's documented here by MS. I did end up making a PowerShell script that will automate the creation of the folder on the Dev Drive (if it doesn't exist), then checks if the folder exists locally and checks if there's anything in it, if there is, then it will copy the content to the new folder on the Dev Drive, then checks if the environmental variables already exists and sets up the environmental variables in 'the user scope' if they don't. If you'd like I think I can share the script (I'm not the only author).
I don't think this has anything to do with the Dev Drive, but instead it just happened to coincide with an update to winget.
@florelis Thanks for the response. Yeah, I thought this too, but I did try to clean install a few times. It just so happens to coincide that every time you move the package cache and the temp directories, it starts to exhibit this behavior. However, it's hard to say, because it seems that winget doesn't work out of the box on a clean Windows 11 install. It only works after you run Windows Update. That said, what I did on the last clean install was disconnect the network and run the setup on the Dev Drive immediately after the completion of the install. However, it still ended having the same issue.
You should be able to uninstall it with winget using that ID (use \ instead of /), but you cannot update it because winget does not have any information about available versions for it.
@florelis Great. That's at least still somewhat helpful. Thank you. Good to know.
@peterlobster that would be helpful. If I can reproduce what's happening, maybe we can figure out a fix or a temporary work around.
@denelon Ok. My colleague @ran-dall, who is the other main author, told me to mention these are very experimental but so far, they've been working for us. FWIW we do plan on open sourcing the scripts once we've tested everything, as we find them useful.
So, we have two main scripts we're working with, SetupDevDrive.ps1 and SetupDevDrivePackageCache.ps1. Both are affixed below:
SetupDevDrive.ps1
- Ensures Dev Drive is trusted
- Ensure filters are correctly attached to Dev Drive (the default is what we use)
- Allows for modifying the AV rule for Dev Drive (not something we're doing currently)
Script
# Function to check if a drive is a Dev Drive
function Get-DevDrive {
$devDrives = Get-Volume | Where-Object { $_.FileSystemType -eq 'ReFS' -and $_.DriveType -eq 'Fixed' }
$devDriveLetters = @()
foreach ($drive in $devDrives) {
$driveLetter = "$($drive.DriveLetter):"
Write-Host "`nDev Drive found: $driveLetter"
$devDriveLetters += $driveLetter
}
if ($devDriveLetters.Count -eq 0) {
Write-Output "No Dev Drive found on the system."
return $null
} elseif ($devDriveLetters.Count -eq 1) {
return $devDriveLetters[0]
} else {
Write-Host "Multiple Dev Drives found:"
for ($i = 0; $i -lt $devDriveLetters.Count; $i++) {
Write-Host "[$i] $($devDriveLetters[$i])"
}
$selection = Read-Host "Please select the drive you want to configure by entering the corresponding number"
if ($selection -match '^\d+$' -and [int]$selection -lt $devDriveLetters.Count) {
return $devDriveLetters[$selection]
} else {
Write-Output "Invalid selection. Exiting script."
return $null
}
}
}
# Function to test if a Dev Drive is trusted
function Test-DevDriveTrusted {
param (
[string]$DriveLetter
)
$result = fsutil devdrv query $DriveLetter | Out-String
return $result -match "This is a trusted developer volume"
}
# Function to get allowed filters on a Dev Drive
function Get-DevDriveAllowedFilters {
param (
[string]$DriveLetter
)
$result = fsutil devdrv query $DriveLetter | Out-String
if ($result -match "Filters allowed on this developer volume:\s*(.*)") {
$allowedFiltersLine = $matches[1]
$allowedFiltersLine = $allowedFiltersLine.Trim()
return $allowedFiltersLine -split ",\s*"
}
return @()
}
# Function to add filters to a Dev Drive
function Add-DevDriveFilters {
param (
[string]$DriveLetter,
[string[]]$Filters
)
$allowedFilters = Get-DevDriveAllowedFilters -DriveLetter $DriveLetter
$filtersToAdd = $Filters | Where-Object { $allowedFilters -notcontains $_ }
if ($filtersToAdd.Count -gt 0) {
$filterString = $filtersToAdd -join ","
try {
fsutil devdrv setfiltersallowed /f /volume $DriveLetter $filterString > $null
Write-Output "Filters added to $DriveLetter $filterString"
} catch {
Write-Error "Failed to add filters to $DriveLetter $_"
}
} else {
Write-Output "All specified filters are already allowed on $DriveLetter."
}
}
# Function to prompt the user to add filters
function PromptForFilters {
param (
[string]$DriveLetter
)
$filters = @()
Write-Host "Default filters: WdFilter, PrjFlt, bindFlt, wcifs, FileInfo, ProcMon24, WinSetupMon"
$defaultResponse = Read-Host "Would you like to use the default filters? (Y/N)"
if ($defaultResponse -eq 'Y') {
$filters += "WdFilter", "PrjFlt", "bindFlt", "wcifs", "FileInfo", "ProcMon24", "WinSetupMon"
} else {
$filterOptions = @(
@{ Name = "PrjFlt"; Description = "GVFS: Sparse enlistments of Windows" },
@{ Name = "MsSecFlt"; Description = "MSSense: Microsoft Defender for Endpoint for EDR Sensor" },
@{ Name = "WdFilter"; Description = "Defender: Windows Defender Filter" },
@{ Name = "bindFlt, wcifs"; Description = "Docker: Running containers out of Dev Drive" },
@{ Name = "FileInfo"; Description = "Windows Performance Recorder: Measure file system operations & Resource Monitor: Shows resource usage. Required to show file names in Disk Activity" },
@{ Name = "ProcMon24"; Description = "Process Monitor - Sysinternals: Monitor file system activities [EXPERIMENTAL]" },
@{ Name = "WinSetupMon"; Description = "Windows Upgrade: Used during OS Upgrade. Required if user moves TEMP environment variable to Dev Drive" }
)
foreach ($option in $filterOptions) {
$response = Read-Host "Do you want to add the filter $($option.Name) - $($option.Description)? (Y/N)"
if ($response -eq 'Y') {
$filters += $option.Name -split ',\s*'
}
}
}
Add-DevDriveFilters -DriveLetter $DriveLetter -Filters $filters
}
# Function to check if the Anti-Virus filter is enabled and give the option to change it
function ManageAntiVirusFilter {
param (
[string]$DriveLetter
)
$result = fsutil devdrv query $DriveLetter | Out-String
$avEnabled = $result -match "Developer volumes are protected by antivirus filter"
if ($avEnabled) {
Write-Host "Developer volumes are currently protected by antivirus filter."
$response = Read-Host "Do you want to disable the antivirus filter? (Y/N)"
if ($response -eq 'Y') {
fsutil devdrv enable /disallowAV > $null
Write-Output "Antivirus filter has been disabled for Dev Drive $DriveLetter."
}
} else {
Write-Host "Developer volumes are not protected by antivirus filter."
$response = Read-Host "Do you want to enable the antivirus filter? (Y/N)"
if ($response -eq 'Y') {
fsutil devdrv enable /allowAV > $null
Write-Output "Antivirus filter has been enabled for Dev Drive $DriveLetter."
}
}
}
# Main Script
$devDrive = Get-DevDrive
if ($null -ne $devDrive) {
$isTrusted = Test-DevDriveTrusted -DriveLetter $devDrive
if (-not $isTrusted) {
$userResponse = Read-Host "`nDev Drive $devDrive is not trusted. Do you want to set it as trusted? (Y/N)"
if ($userResponse -eq 'Y') {
fsutil devdrv trust $devDrive > $null
Write-Output "Dev Drive $devDrive has been set as trusted."
} else {
Write-Output "Dev Drive $devDrive remains untrusted."
exit
}
} else {
Write-Output "`nDev Drive $devDrive is already trusted."
}
ManageAntiVirusFilter -DriveLetter $devDrive
PromptForFilters -DriveLetter $devDrive
} else {
Write-Output "No Dev Drive found to configure."
}
SetupDevDrivePackageCache.ps1
- If cache folder doesn't exist on Dev Drive, create it
- If cache folder already exists locally, move it
- Setup Environment Variables
- Move and setup Temp folder
Script
# Function to check if a drive is a Dev Drive
function Get-DevDrive {
$devDrives = Get-Volume | Where-Object { $_.FileSystemType -eq 'ReFS' -and $_.DriveType -eq 'Fixed' }
$devDriveLetters = @()
foreach ($drive in $devDrives) {
$driveLetter = "$($drive.DriveLetter):"
Write-Host "`nDev Drive found: $driveLetter"
$devDriveLetters += $driveLetter
}
switch ($devDriveLetters.Count) {
0 {
Write-Output "No Dev Drive found on the system."
return $null
}
1 {
return $devDriveLetters[0]
}
default {
Write-Host "Multiple Dev Drives found:"
for ($i = 0; $i -lt $devDriveLetters.Count; $i++) {
Write-Host "[$i] $($devDriveLetters[$i])"
}
while ($true) {
$selection = Read-Host "Please select the drive you want to configure by entering the corresponding number"
if ($selection -match '^\d+$' -and [int]$selection -lt $devDriveLetters.Count) {
return $devDriveLetters[$selection]
} else {
Write-Host "Invalid selection. Please enter a valid number."
}
}
}
}
}
# Main script to set up the Environment Variables for Package Cache
# Retrieve the Dev Drive
$selectedDrive = Get-DevDrive
if ($selectedDrive) {
Write-Host "Selected Dev Drive: $selectedDrive`n"
} else {
Write-Host "No valid Dev Drive selected. Exiting script."
exit 1
}
# Define the Dev Drive base path
$DevDrive = "$selectedDrive\packages"
# Function to create a directory if it doesn't exist
function New-DirectoryIfNotExists {
param (
[string]$Path
)
if (-not (Test-Path -Path $Path)) {
New-Item -Path $Path -ItemType Directory -Force
Write-Output "Created directory: $Path"
} else {
Write-Output "Directory already exists: $Path"
}
}
# Function to set a user environment variable with verbose output
function Set-UserEnvironmentVariable {
param (
[string]$Name,
[string]$Value
)
$currentValue = [System.Environment]::GetEnvironmentVariable($Name, [System.EnvironmentVariableTarget]::User)
if ($currentValue -eq $Value) {
Write-Output "Environment variable '$Name' is already set to '$Value'. No further setup is required."
} else {
try {
$output = setx $Name $Value
if ($output -match "SUCCESS: Specified value was saved.") {
Write-Output "SUCCESS: Environment variable '$Name' was set to '$Value'."
} else {
Write-Output "ERROR: Could not set environment variable '$Name'. Message: $output"
}
} catch {
Write-Output "ERROR: Access to the registry path is denied for environment variable '$Name'."
}
}
}
# Function to move contents from one directory to another
function Move-CacheContents {
param (
[string]$SourcePath,
[string]$DestinationPath
)
if (Test-Path -Path $SourcePath) {
Move-Item -Path "$SourcePath\*" -Destination $DestinationPath -Force
Remove-Item -Path $SourcePath -Recurse -Force
Write-Output "Moved contents from '$SourcePath' to '$DestinationPath' and removed the old directory."
} else {
Write-Output "No contents to move from '$SourcePath'."
}
}
# Create necessary directories
$directories = @(
"$DevDrive\npm",
"$DevDrive\$env:USERNAME\.nuget\packages",
"$DevDrive\vcpkg",
"$DevDrive\pip",
"$DevDrive\cargo",
"$DevDrive\maven",
"$DevDrive\gradle"
)
Write-Output "### Directory Setup ###"
foreach ($dir in $directories) {
New-DirectoryIfNotExists -Path $dir
}
Write-Output ""
# Environment variable setup and cache moving
$cacheSettings = @(
@{ Name = "npm_config_cache"; Value = "$DevDrive\npm"; SourcePaths = @("$env:APPDATA\npm-cache", "$env:LOCALAPPDATA\npm-cache") },
@{ Name = "NUGET_PACKAGES"; Value = "$DevDrive\$env:USERNAME\.nuget\packages"; SourcePaths = @("$env:USERPROFILE\.nuget\packages") },
@{ Name = "VCPKG_DEFAULT_BINARY_CACHE"; Value = "$DevDrive\vcpkg"; SourcePaths = @("$env:LOCALAPPDATA\vcpkg\archives", "$env:APPDATA\vcpkg\archives") },
@{ Name = "PIP_CACHE_DIR"; Value = "$DevDrive\pip"; SourcePaths = @("$env:LOCALAPPDATA\pip\Cache") },
@{ Name = "CARGO_HOME"; Value = "$DevDrive\cargo"; SourcePaths = @("$env:USERPROFILE\.cargo") },
@{ Name = "GRADLE_USER_HOME"; Value = "$DevDrive\gradle"; SourcePaths = @("$env:USERPROFILE\.gradle") }
)
foreach ($setting in $cacheSettings) {
Write-Output "### Setting up $($setting.Name) ###"
Set-UserEnvironmentVariable -Name $setting.Name -Value $setting.Value
foreach ($source in $setting.SourcePaths) {
Move-CacheContents -SourcePath $source -DestinationPath $setting.Value
}
Write-Output ""
}
# Additional step to set MAVEN_OPTS and move Maven repository
Write-Output "### Setting up MAVEN_OPTS ###"
$mavenRepoLocal = "$DevDrive\maven"
New-DirectoryIfNotExists -Path $mavenRepoLocal
$mavenOpts = [System.Environment]::GetEnvironmentVariable('MAVEN_OPTS', [System.EnvironmentVariableTarget]::User)
$escapedMavenRepoLocal = [regex]::Escape($mavenRepoLocal)
if ($mavenOpts -notmatch "-Dmaven\.repo\.local=$escapedMavenRepoLocal") {
$newMavenOpts = "-Dmaven.repo.local=$mavenRepoLocal $mavenOpts"
Set-UserEnvironmentVariable -Name "MAVEN_OPTS" -Value $newMavenOpts
Write-Output "Environment variable 'MAVEN_OPTS' set to: $newMavenOpts"
} else {
Write-Output "Environment variable 'MAVEN_OPTS' is already set correctly. No further setup is required."
}
Move-CacheContents -SourcePath "$env:USERPROFILE\.m2\repository" -DestinationPath $mavenRepoLocal
Write-Output ""
# Optional: Move TMP and TEMP to Dev Drive if not already on Dev Drive
Write-Output "### Setting up TMP and TEMP ###"
$currentTemp = [System.Environment]::GetEnvironmentVariable('TEMP', [System.EnvironmentVariableTarget]::User)
$currentTmp = [System.Environment]::GetEnvironmentVariable('TMP', [System.EnvironmentVariableTarget]::User)
if (($currentTemp -notlike "$selectedDrive*") -or ($currentTmp -notlike "$selectedDrive*")) {
$confirmMoveTemp = Read-Host "Do you want to move TMP and TEMP directories to the Dev Drive? (y/n)"
if ($confirmMoveTemp -eq 'y') {
$tempPath = "$selectedDrive\temp"
New-DirectoryIfNotExists -Path $tempPath
Set-UserEnvironmentVariable -Name "TEMP" -Value $tempPath
Set-UserEnvironmentVariable -Name "TMP" -Value $tempPath
Write-Output "Environment variables 'TEMP' and 'TMP' set to: $tempPath"
} else {
Write-Output "Skipping move of TMP and TEMP directories."
}
} else {
Write-Output "TEMP and TMP are already set to the Dev Drive."
}
Write-Output ""
Write-Output "### Setup Complete ###"
Write-Output "Package cache on Dev Drive was set successfully."
(Also, to note, both scripts will try to automatically find the Dev Drive)
I should also mention that we also manually add a user with full control over the directories to the Dev Drive. However, beyond that, those are the steps to replicate.
I noticed something subtle in what was stated about running Windows Update and WinGet being updated on a fresh Windows 11 install.
Currently, WinGet is updated via the Microsoft Store independent of what Windows Update is doing. It's likely the version of WinGet on a fresh install is out of date.
If it's WinGet 1.6 or newer, WinGet can upgrade itself via the community repository with winget upgrade --all, the other options are to use the store client to update all store packages (or selectively, App Installer). You could also use the Microsoft.WinGet.Client PowerShell module and run Repair-WinGetPackageManager -Force -Latest to get the latest stable version.
If it's WinGet 1.6 or newer, WinGet can upgrade itself via the community repository with winget upgrade --all, the other options are to use the store client to update all store packages (or selectively, App Installer).
@denelon When I try to run winget upgrade --all on a fresh Windows 11 install, I get no output.
You could also use the Microsoft.WinGet.Client PowerShell module and run Repair-WinGetPackageManager -Force -Latest to get the latest stable version.
@denelon This is a clever idea (one I considered before, but wasn't sure if it would have any result), however, also this produced no output on a fresh Windows 11 install.
@denelon Update: So I tried uninstalling and reinstalling the packages like you suggested, turns out, even if you do reinstall, the same problem exists.
We made some changes in the client for 1.8 and 1.9-preview to handle packages installed side-by-side. The packages starting with prefixes like "ARP" or "MSIX" are packages that are installed on the device, but not matching with any of WinGet's configured sources.
Those packages may be removable using winget uninstall <package ID> or repairable using winget repair <package ID>, but WinGet has no way to update them since they aren't correlated with any configured source.
Those packages may be removable using winget uninstall <package ID> or repairable using winget repair <package ID>, but WinGet has no way to update them since they aren't correlated with any configured source.
@denelon My apologies for not being clearer. So, I uninstalled winget uninstall MSIX\SpotifyAB.SpotifyMusic_1.242.290.0_x64__zpdnekdrzrea0 which uninstalled Spotify. I went back to the MS Store and downloaded it directly, and on winget list, I still see...
...
Spotify Music MSIX\SpotifyAB.SpotifyMusic_1.242.290.0_x64__zpdnekdrzrea0 1.242.290.0
...
(I also just reconfirmed the behavior)
Thank you for the tip using `winget repair <package ID>, however, it doesn't seem to have any notable effect on the issue in this case.
PS> winget repair MSIX\SpotifyAB.SpotifyMusic_1.242.290.0_x64__zpdnekdrzrea0
Found Spotify Music [MSIX\SpotifyAB.SpotifyMusic_1.242.290.0_x64__zpdnekdrzrea0]
Starting package repair...
██████████████████████████████ 100%
Repair operation completed successfully.
I believe this is a case of Spotify having an age rating so it's not available to WinGet via the REST source "msstore". If WinGet was used to install a package via the "msstore" source, then the source would match via winget list. The "msstore" source doesn't offer the version information for newer versions of packages available to WinGet via the REST endpoint so it shows as "Unknown" as the latest version available. That is the reason WinGet doesn't offer updates to "msstore" packages.
There are several related issues:
- https://github.com/microsoft/winget-cli/issues?q=is%3Aissue+is%3Aopen+label%3Amsstore+upgrade
We're working on the problem of how to handle the additional requirements for offering version information to WinGet for packages in the "msstore" source. There is work to be done by both teams. On the WinGet side, we need to provide additional information to the "msstore" source to help identify which versions of packages are applicable for the device and the user MSA logged into the store, and their REST source would need to be able to offer the specific version that applies in that case.
The Microsoft Store shows a "TEEN" rating for Spotify and the "msstore" REST source only offers content rated "E for Everyone" to the WinGet CLI.
I experienced this problem of multiple MSIX after a recent Windows update.
Not sure if it could be related.