Hi guys. Can we add killswitch when installing/upgrading this package?
When machine has VSCode open, upgrade fails with MSI code '1'.
It can be a burden to do automated deploy.
Kill switch should be optional.
When upgrading package, with VSCode open by current user or any other user (RDP/Terminal) if killswitch is set to on, we can kill all instances of vscode.
When upgrading package, with VSCode open by current user or any other user (RDP/Terminal) MSI exits with code '1'
@pascalberger since visual studio code uses inno setup, maybe see if all we need is to add the following to the silent arguments /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS?
@AdmiringWorm Unfortunately doesn't work. Calling setup with /silent /forcecloseapplications leads to this:

Together with the /suppressmsgboxes slot it will return with exit code 5.
What about something brutal?
$killexec = 1
$killexecprocess = "doublecmd*"
# Should we kill some exec ?
if ($killexec) {
Stop-Process -processname $killexecprocess -force
}
Start-Sleep -s 10
Install-ChocolateyPackage @packageArgs
I used it in doublecmd package.
How about something non brutal: ps code | % { $_.CloseMainWindow() } ?
On my system it even saves automatically currently edited but not saved files (with "files.autoSave": "off",)
ForEach-Object : Cannot bind parameter 'RemainingScripts'. Cannot convert the "?" value of type "System.String" to
type "System.Management.Automation.ScriptBlock".
At line:1 char:38
+ ps code | % { $_.CloseMainWindow() } ?
+ ~
+ CategoryInfo : InvalidArgument: (:) [ForEach-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ForEachObjectComman
@marcinbojko remove the question mark (?) and try again.
Thanks. Works with saved and unsaved files in project.
Guys, tested with 16.x and 17.1 - this behaviour still stays.
ERROR: Running ["C:\Windows\TEMP\chocolatey\VisualStudioCode\1.17.2\VSCodeSetup-x64-1.17.2.exe" /verysilent /suppressmsgboxes /mergetasks="!runCode, desktopicon, quicklaunchicon, addcontextmenufiles, addcontextmenufolders, addtopath" /log="C:\Windows\TEMP\chocolatey\vscode.log" ] was not successful. Exit code was '5'. See log for possible error messages.
The upgrade of visualstudiocode was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\VisualStudioCode\tools\ChocolateyInstall.ps1'.
See log for details.