Hi all,
for the purpose of our organization I am trying to create a visual studio build tools installation script.
Downloading the installer is easy. Basic installation is easy. But I struggle to use .vsconfig file to ensure the same components are installed everywhere.
So far I got:
Write-Output "Basic install"
Start-Process -FilePath $vsbt_installer_exe -ArgumentList "--installPath", "C:\buildtools", "--passive", "--norestart", "--nocache", "--wait" -Wait
Write-Output "Components install"
Start-Process -FilePath $vsbt_installer_exe -ArgumentList "modify", "--installPath", "C:\buildtools", "--passive", "--norestart", "--nocache", "--wait", "--config", $env:VSBT_CONFIGURATION -Wait
The basic installation goes fine, the second one produces error in log (and shows "Error: Something went wrong." if not passive):
[1ad4:0001][2021-07-23T06:08:07] Setting the locale to en-US.
[1ad4:0001][2021-07-23T06:08:07] Saving the current locale (en-US) to user.json.
[1ad4:0001][2021-07-23T06:08:07] Setting the telemetry services
[1ad4:0001][2021-07-23T06:08:07] Visual Studio Installer Version: 2.11.13
[1ad4:0001][2021-07-23T06:08:07] Raw Command line: "C:\Program Files (x86)\Microsoft Visual Studio\Installer\setup.exe" modify --passive --installPath C:\buildtools --norestart --nocache --config .vsconfig --locale en-US --activityId "95664762-5c25-4df4-8f36-dfeb030609a2" --pipe "a8e2ba65-7c24-4e18-84b8-a133caf7cf39"
[1ad4:0001][2021-07-23T06:08:07] Parsed command line options: modify --activityId 95664762-5c25-4df4-8f36-dfeb030609a2 --config .vsconfig --installPath C:\buildtools --locale en-US --nocache --norestart --passive --pipe a8e2ba65-7c24-4e18-84b8-a133caf7cf39
[1ad4:0001][2021-07-23T06:08:07] Using registry value of (N/A) to theme installer.
[1ad4:0001][2021-07-23T06:08:07] Getting singleton lock. Mutex name: DevdivInstallerUI
[1ad4:0001][2021-07-23T06:08:08] Getting singleton lock succeed.
[1ad4:0006][2021-07-23T06:08:08] Creating a new telemetry service.
[1ad4:0006][2021-07-23T06:08:09] Telemetry session ID: 4674f92b-c865-4818-8614-92aca65ed45c
[1ad4:0006][2021-07-23T06:08:09] Creating new ExperimentationService
[1ad4:0006][2021-07-23T06:08:09] Telemetry property VS.ABExp.Flights : lazytoolboxinit;fwlargebuffer;refactoring;spmoretempsbtn1;asloff;keybindgoldbarext;asynccsproj;vsfricheditor;completionapi;tn-vsmacnps-7;toggleblockcomment;tasmigddvs;multitenanttasmigration_002;vsfdevcom2;lsprmsgvol;parallel-lsp-clients;vswnewinstaller
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.source : WPF
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.locale : en-US
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.installerversion : 2.11.13.53049
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.startmethod : indirect
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.activityid : 95664762-5c25-4df4-8f36-dfeb030609a2
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.campaign :
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.passive : True
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.quiet : False
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.processtype : ui
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.force : False
[1ad4:0006][2021-07-23T06:08:09] Telemetry property vs.willow.noweb : False
[1ad4:0001][2021-07-23T06:08:10] Monitor center position: 576, 412
[1ad4:000a][2021-07-23T06:08:10] An abnormal shutdown was detected from the previous telemetry session.
[1ad4:0001][2021-07-23T06:08:12] Navigation requested from ApplicationViewModel to MainPageViewModel
[1ad4:000c][2021-07-23T06:08:13] Telemetry property VS.SetupEngine.ChannelUpdateDisabled : False
[1ad4:000c][2021-07-23T06:08:13] Trying to remove channel manifest: C:\Users\IEUser\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\A0FE1051\installChannelManifest.json
[1ad4:000c][2021-07-23T06:08:13] Trying to remove product manifest: C:\Users\IEUser\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\A0FE1051\install_catalog.json
[1ad4:000c][2021-07-23T06:08:13] Trying to remove channel manifest: C:\Users\IEUser\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\A0FE1051\installChannelManifest.json
[1ad4:000c][2021-07-23T06:08:13] Trying to remove product manifest: C:\Users\IEUser\AppData\Local\Microsoft\VisualStudio\Packages\_Channels\A0FE1051\install_catalog.json
[1ad4:000d][2021-07-23T06:08:13] Uri 'https://go.microsoft.com/fwlink/?linkid=857708' redirected to 'https://sendvsfeedback2.azurewebsites.net/api'
[1ad4:000c][2021-07-23T06:08:14] Showing the window.
[1ad4:0001][2021-07-23T06:08:16] Error 0x80004003: Object reference not set to an instance of an object.
at Microsoft.VisualStudio.Setup.Installer.InstallationDetails.SelectionInitializer.<<ImportInstallationConfiguration>b__19_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Setup.Installer.InstallationDetails.SelectionInitializer.<<InitializeAsync>b__17_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Setup.Installer.CommandLine.Handlers.ModifyCommandLineHandler.<>c__DisplayClass6_0.<<HandleAsyncImpl>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Setup.Installer.Services.CommandLineOptionsService.<HandleCommandlineAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Setup.Installer.ViewModels.MainPageViewModel.<<InitializeAsync>b__8_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Setup.Installer.ViewModels.ApplicationViewModel.<<InitializeAsync>b__9_1>d.MoveNext()
[1ad4:0001][2021-07-23T06:08:16] An exception happened while Initializing VM. Showing the error dialog.
[1ad4:0001][2021-07-23T06:08:16] Sorry, something went wrong.
[1ad4:000a][2021-07-23T06:08:16] Telemetry property vs.setup.WorkloadOverrides.DidReceiveOverride : False
[1ad4:000a][2021-07-23T06:08:16] Telemetry property vs.setup.WorkloadOverrides.RuleId : None
[1ad4:000c][2021-07-23T06:08:16] Download requested: https://go.microsoft.com/fwlink/?linkid=2066144
[1ad4:0010][2021-07-23T06:08:16] Attempting download 'https://go.microsoft.com/fwlink/?linkid=2066144' using engine 'WebClient'
[1ad4:0010][2021-07-23T06:08:17] Uri 'https://go.microsoft.com/fwlink/?linkid=2066144' redirected to 'https://vsstartpage.blob.core.windows.net/news/vs'
[1ad4:0010][2021-07-23T06:08:17] Download of 'https://go.microsoft.com/fwlink/?linkid=2066144' succeeded using engine 'WebClient'
[1ad4:0001][2021-07-23T06:08:30] Button clicked: ButtonName: CloseWindow, Action: None, Message:
[1ad4:0001][2021-07-23T06:08:30] Shutting down the application with exit code 0
[1ad4:0001][2021-07-23T06:08:30] Releasing singleton lock.
[1ad4:0001][2021-07-23T06:08:30] Releasing singleton lock succeed.
[1ad4:0001][2021-07-23T06:08:30] Releasing singleton lock.
[1ad4:0001][2021-07-23T06:08:30] Singleton lock does not exist. Releasing singleton lock skipped.
[1ad4:0001][2021-07-23T06:08:30] Closing the installer with exit code 0
[1ad4:0001][2021-07-23T06:08:30] Exit Code: 0
[1ad4:0001][2021-07-23T06:08:30] Cleared previous session ID.
with .vsconfig exported from working configuration:
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.CoreBuildTools",
"Microsoft.VisualStudio.Workload.MSBuildTools",
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.CoreBuildTools",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.Windows10SDK.19041",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.TestTools.BuildTools",
"Microsoft.VisualStudio.Component.VC.ASAN",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.Workload.VCTools",
"Microsoft.VisualStudio.Component.VC.14.25.x86.x64",
"Microsoft.VisualStudio.Component.VC.14.25.ATL",
"Microsoft.VisualStudio.Component.VC.14.25.MFC"
]
}
The .vsconfig works fine if imported manually.