jberezanski / ChocolateyPackages

Chocolatey packages maintained by me
MIT License
83 stars 51 forks source link

[visualstudio2019buildtools] Error due to file access rights deleting `.lastupdatedate` #127

Closed SeanKilleen closed 2 years ago

SeanKilleen commented 2 years ago

Versions:

I tried:

Output:

Progress: Downloading visualstudio2019buildtools 16.11.13.0... 100%

visualstudio2019buildtools v16.11.13.0 [Approved]
visualstudio2019buildtools package files upgrade completed. Performing other installation steps.
ERROR: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Cannot remove item C:\Users\SeanK\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\c291ba1b\.lastupdatedate: You do not have sufficient access rights to perform this operation.
The upgrade of visualstudio2019buildtools was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2019buildtools\tools\ChocolateyInstall.ps1'.
 See log for details.

I'm using Windows Defender, so I added an exemption for C:\Users\SeanK\AppData\Local\Microsoft\VisualStudio\Packages\_Channels and disabled/re-enabled scanning. The same issue persisted. So I don't think it's an AV issue in this case.

jberezanski commented 2 years ago

I've seen it once, I think, out of several tens of installs, so it may be hard to reproduce. But I have an idea for a mitigation and I might implement something over the weekend.

OraDotNetDev commented 2 years ago

Just had this occur on a couple of machines when running choco upgrade visualstudio2022professional to v117.1.6.0. Should I retry after upgrading chocolatey-visualstudio.extension to 1.10.1?

@jberezanski if there any logs which could assist in investigation, happy to upload?

It's re-occurring on at least one machine, so could re-run upgrade with debug on?

# original installation arguments
choco upgrade visualstudio2022professional --packageparameters '--quiet --includeOptional' --ignorerememberedargs --execution-timeout=14400
jberezanski commented 2 years ago

@OraDotNetDev Yes, please try after upgrading the extension. The newest VS 2022 packages already depend on it, but they are still in moderation.

jberezanski commented 2 years ago

The root cause is that the latest versions of Visual Studio Installer started producing files with the "Hidden" attribute set, which Remove-Item refuses to delete without -Force.

OraDotNetDev commented 2 years ago

Hi Jakub, thanks very much for your speedy response on this 🥇

After installing the latest version of the chocolatey-visualstudio.extension release (1.10.2) Visual Studio now upgrades successfully.

jberezanski commented 2 years ago

Glad to hear it!

Meanwhile, the updated VS 2022 packages have encountered issues in moderation - apparently, the VS 2022 Installer has started using operating system functionality not available on Server 2012 R2 (the OS the Chocolatey Package Verifier is currently based on) and the packages now fail to install on 2012 R2, so they fail the verification step of moderation. (To be fair, the official system requirements of VS 2022 do say that only Server 2016+ is supported, but it worked on older OS until now.) I need to ask for moderation exemptions, so there may be a delay.

jberezanski commented 2 years ago

All packages have passed moderation now.