On problems updating .NET packages installed by Visual Studio Installer with WinGet

March 13, 2024

Setup

I have a win dev box with latest VS 2022 and installed with all the web payloads I can. Most of packages regarding .NET 8 seems to be installed this way (Visual Studio Installer). Also I use winget and choco to “work” with apps and install/update them on daily basis.

After latest updates I saw many packages being bumped up with fix version and so I just tried (as usual) update them with winget update --all which seems to have problems doing that.

I ended up with 2 different versions of the same package like this

hosting bundle not uninstalled

although I tried to update using winget

after updating the .NET hosting bundle I was still able to see 2 versions of the same package

but what I ultimately just wanted to do is to update the package to the latest version. In this article I assume you wanted to do the same thing. If you need more versions side by side you should be good with what you just have (lucky you) on you machine now (you can check in installed apps and search for your needed package).

The fix

One of possible fixes (this one worked for me) was extra work to

  • download setup of older package you have installed
  • uninstall first the latest one
  • then the previous one with downloaded package (that you I suppose do not need)
  • again install the latest version of the package

How to

The biggest problem here is to find out that latest .NET packages seems to mess up somehow the install cache and are not able to uninstall themselves just via add remove programs and you need to make the extra step by downloading the old install package and uninstall it by hand. The package will not tell you it has problem and will say all was fine although it failed to uninstall.

while saying all is fine the package failed to uninstall while having newer version installed side by side

You can tell if all was OK by looking at the uninstall progress bar and if no steps happened result might be failure.

I saw this only when uninstalling v 8.0.2 while having later version of package installed 8.0.3.

If I uninstalled latest one (8.0.3) and I tried to uninstall also 8.0.2 (now the only version of package in the system) then the uninstall failed like this

package being uninstalled looking for files

Fix to this is to download whole corresponding package and uninstall from that. You can see all the versions with packages here dot net 8 downloads

alt text

Hope this helps.


Profile picture

Written by Dušan Roštár - the "mr edge case" guy
my twitter : rostacik, my linkedin : rostar, drop me an email : here