Closed exoosh closed 4 months ago
Hi @exoosh,
If I'm understanding correctly, the error was caused by another installer being open. This might be expected, as only one install can proceed at a time.
How would you prefer WinGet to respond when it's installing something and there's already an installer open? Should it error and abort, kill the other installer and proceed, or retry when the other install is complete?
Hi @stephengillie,
not another installer but PowerShell running with the VS Developer Prompt open (i.e. %ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Microsoft.VisualStudio.DevShell.dll
in use). And yes, in case of the interactive installation I did get a prompt showing pwsh
to be the culprit, and subsequently closed the tab after which the installation was able to proceed.
I am not really sure what installer technology VS uses under the hood, but it looked akin to Windows Installer. Windows Installer has a mode that allows it to proceed with the installation despite some component being in use by using MoveFileEx
as pointed out above. So essentially it would schedule the new component to be moved into the place of the old one upon next reboot.
What's also interesting is that I noticed this the first time around now in the upgrade to 17.7.2 although I have had the PowerShell Dev Prompt as a default in Windows Terminal for a long time (and it was thus in use all the same).
PS: I am not even sure that winget is necessarily to blame here, could as well be a change in the VS installer. But since I have used winget for months to keep VS up-to-date, and this was the first time it failed, I thought I'd type up a defect report.
I have since updated VS2022 several times using winget
and never saw this issue again. So I guess this could be closed?!
Please confirm these before moving forward
Category of the issue
Installation issue.
Brief description of your issue
Upgrading
Microsoft.VisualStudio.2022.Enterprise
fails with:Observations
I then went ahead and used the interactive method of upgrading Visual Studio and it turned out that PowerShell (PS Core, i.e.
pwsh
in my case) was running and the Visual Studio Installer was complaining about that.And indeed PowerShell was running in Windows Terminal with the following command line:
I know Windows Installer has a way to schedule files to be moved/deleted at reboot via the session manager (effectively through
MoveFileEx
with flagMOVEFILE_DELAY_UNTIL_REBOOT
or an equivalent method). Perhaps that's what missing? Anything else would require the upgrade to always be interactive, which seems undesirable.Steps to reproduce
Not sure, for me it was merely trying the upgrade with while PS Core was running with the Developer Prompt open in a tab:
Actual behavior
Getting a failure:
Expected behavior
I expected the upgrade to be performed.
Environment