jberezanski / ChocolateyPackages

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

visualstudio2022buildtools fails to create or update offline layout #148

Closed benh57 closed 9 months ago

benh57 commented 1 year ago

Not sure when this started or if it's just me, but sometime since April since it worked then. Maybe a change on the MS side? I've tried on a few machines. If you aren't able to reproduce, then i can upload my full logs.

Run: choco install -y visualstudio2022buildtools --params "--layout C:\test-offline --lang en-US" Result: The layout creation goes a few minutes, but exits before doing much. It does download the certificates. The only files in C:\test-offline created are:

vs_installer.version.json
certificates\vs_installer_opc.RootCertificate

I AM still able to create an offline layout manually using vs_buildtools.exe:

vs_BuildTools.exe --layout C:\test-offline

ThomasPatzig commented 11 months ago

confirm

I run:

choco install visualstudio2022buildtools --force --params "--layout C:\temp\test --add Microsoft.Component.MSBuild --lang en-us --quiet --wait --norestart"

it fails with

ERROR: The installation of visualstudio2022buildtools failed (installer exit code: 87).
The install of visualstudio2022buildtools was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2022buildtools\tools\ChocolateyInstall.ps1'.
 See log for details.

but direct call of installer works:

vs_BuildTools.exe --layout C:\Temp\test --add Microsoft.Component.MSBuild --lang en-us --norestart --quiet --wait'
ThomasPatzig commented 11 months ago

it looks like that the --params "*" are not correctly transferred to the call of vs_BuildTools.exe after download

ThomasPatzig commented 11 months ago

same for "visualstudio2022enterprise"

ThomasPatzig commented 11 months ago

full console output:

C:\temp>choco install visualstudio2022buildtools --force --yes --params "--layout C:\temp\test --add Microsoft.Component.MSBuild --lang en-us --quiet --wait --norestart"
Chocolatey v2.2.0
Installing the following packages:
visualstudio2022buildtools
By installing, you accept licenses for the packages.
visualstudio2022buildtools v117.6.5 already installed. Forcing reinstall of version '117.6.5'.
 Please use upgrade if you meant to upgrade to a new version.

visualstudio2022buildtools v117.6.5 (forced)
visualstudio2022buildtools package files install completed. Performing other installation steps.
WARNING: Creating an offline installation source for visualstudio2022buildtools in 'C:\temp\test'. visualstudio2022buildtools will not be actually installed.
Using system proxy server '<proxy>:8080'.
Downloading visualstudio2022buildtools
  from 'https://download.visualstudio.microsoft.com/download/pr/67cb4c13-1e6d-4bf5-97ed-93636beebd7d/bbd9e99e837140cc7838ec63d0609c5e63ff43001cfa1e558b48db235f015237/vs_BuildTools.exe'
Using system proxy server '<proxy>:8080'.
Progress: 100% - Completed download of C:\Users\<user>\AppData\Local\Temp\chocolatey\visualstudio2022buildtools\117.6.5\vs_BuildTools.exe (3.61 MB).
Download of vs_BuildTools.exe (3.61 MB) completed.
Hashes match.
Installing visualstudio2022buildtools...

Preparing: C:\Users\<user>\AppData\Local\Temp\chocolatey\04c15a19826727a829ae302cd0\vs_bootstrapper_d15\HelpFile\1046\help.html...
...
Preparing: C:\Users\<user>\AppData\Local\Temp\chocolatey\04c15a19826727a829ae302cd0\vs_bootstrapper_d15\vs_setup_bootstrapper.json...

ERROR: The installation of visualstudio2022buildtools failed (installer exit code: 87).
The install of visualstudio2022buildtools was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2022buildtools\tools\ChocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - visualstudio2022buildtools (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2022buildtools\tools\ChocolateyInstall.ps1'.
 See log for details.
ThomasPatzig commented 11 months ago

have also tried multiple chocolaty version

same error behavior with all that versions:

chocolatey 2.2.0 chocolatey 2.1.0 chocolatey 2.0.0 chocolatey 1.4.0

ThomasPatzig commented 11 months ago

I used it now via this workaround:

I call choco install visualstudio2022buildtools --noop and curl the latest vs_BuildTools.exe from -Url

then I call installer with parameters directly: vs_BuildTools.exe --layout C:\temp\test --add Microsoft.Component.MSBuild --lang en-us --quiet --wait --norestart

but I hope the expected call via choco will be work again in future: choco install visualstudio2022buildtools --force --yes --params "--layout C:\temp\test --add Microsoft.Component.MSBuild --lang en-us --quiet --wait --norestart"

jberezanski commented 9 months ago

Investigating.

benh57 commented 9 months ago

Great news, thanks for fixing it! (while you're around maybe you could bump the packages to 17.7.4 :D

jberezanski commented 9 months ago

Yes, It was a bug in the package scripts - a recently added feature broke the layout creation due to unexpected behavior of the VS Installer in layout mode. I will publish a new version of chocolatey-visualstudio.extension soon.

I will not be publishing new versions of VS packages just to bump their dependencies, but the package dependencies will soon get updated when Microsoft releases new VS versions. Until then, in order to create a layout on a machine with VS already installed via choco, chocolatey-visualstudio.extension will need to be updated explicitly (choco upgrade chocolatey-visualstudio.extension).

@ThomasPatzig please note you do not need to pass --quiet --wait --norestart when using the VS choco packages, this is taken care for automatically.

jberezanski commented 9 months ago

Everything should be available on chocolatey.org now, including new versions of VS 2022 packages with dependency on the fixed extension. Could you please confirm the fix worked for you?

ThomasPatzig commented 9 months ago

ok, will check...

confirm

choco install visualstudio2022buildtools --force --params "--layout C:\temp\test --add Microsoft.Component.MSBuild --lang en-us"

return with:

visualstudio2022buildtools has been installed.
WARNING: An offline installation source for visualstudio2022buildtools has been created in 'C:\temp\test'.
WARNING: To install visualstudio2022buildtools using this source, pass '--bootstrapperPath C:\temp\test\vs_BuildTools.exe' as package parameters.
WARNING: Installation will now be terminated so that Chocolatey does not register this package as installed, do not be alarmed.
ERROR: An offline installation source has been created; the software has not been actually installed.
The install of visualstudio2022buildtools was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2022buildtools\tools\ChocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - visualstudio2022buildtools (exited 814) - Error while running 'C:\ProgramData\chocolatey\lib\visualstudio2022buildtools\tools\ChocolateyInstall.ps1'.
 See log for details.

like before... layout folder created as expected.

jberezanski commented 9 months ago

Great!