Vscode: Support auto update for Windows and Linux ZIP

Created on 14 Aug 2018  路  17Comments  路  Source: microsoft/vscode

Hi,

Updating VSCode Insiders (portable) on macOS is a great experience; it simply restarts the app and applies the update.

However VSCode Insiders (portable) on Windows, prompts me every single day to download a zip file. Not only does this method take a lot of time regularly, it also takes a ton of time to sync tens of thousands of files in Dropbox, where the portable versions will typically be placed.

Could we have the Windows version update same as the macOS version? :)

feature-request install-update linux windows

Most helpful comment

I created a PowerShell script to automate the update process

```` powershell

Remove temp file from portable user data

Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

Download latest insiders build

curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/insider -o insider.zip

Delete anything except user data, update script and downloaded zip file

Get-ChildItem -Exclude @("data", "update.ps1", "insider.zip") | Remove-Item -Recurse -Force

Unzip it

Expand-Archive -Path "insider.zip" -DestinationPath .

Delete downloaded package

Remove-Item -Path "insider.zip"
Pause
````

Name it update.ps1 and place it in Code's folder. Run it when you see new version notifications.

All 17 comments

Try the new user level installer, which can update in place.

https://code.visualstudio.com/updates/v1_26#_user-setup-for-windows

Is need to run the portable version. As far as I can see the new installer is for a regular install?

Seamless updates on Windows are currently only supported if you install the Setup package. As @yume-chan mentions, right now you can have the user installable package will gets very close to the macOS experience.


As a workaround, you can always write an external script which does it outside of Code, like I did for Linux: https://gist.github.com/joaomoreno/7d3926e67e91317cd9d053c2c3956ddc

Just so know it's a quite a burden to be in windows portable Insider. If you use portable versions of VSC (and any apps), you probably have them in Dropbox. Every time you want to update VSC Insiders (potentially every day), you need to:

  1. download a zip file and extract it.
  2. move the old data folder over in the new one.
  3. delete the old VSCode.
  4. move the new VSCode into the Dropbox folder.
  5. last but not least, sync ~ 70,000 files (if you have a some extensions as I do).

It's quite a big burden, and especially the dropbox syncing of ~10^5 files takes an eternity because there are so many files in a typical VSCode installation.

Why use portable?

I'm a portable user because:

  1. My university can, and have, delete my whole userspace whenever they feel like it to keep the computer performant. I can't trust anything 100% to be there that's not in Dropbox.

  2. The individual computers at the databars / library can be occupied by other users, so one have to have a portable workflow to work on other computers.

Also, I need to log into GitHub.com again everytime via the pop up window because the GH login is apparently not saved in the portable data folder.

Having exactly the same nightmare as @GandalfSaxe with the portable VSCode update: get notification, redirected to the browser, download, unpack, move data, replace install folder with new, sync, and pray that all still works... Was about to file a new issue, but found this one))

I have another reason to work with portable VSCode and NodeJS: I use several desktops (different hardware/network setups in the office plus home) for my development and it was taking way too much time to keep them all in-sync and up-to-date with VSCode/NodeJS/extensions/configuration/etc. Syncing "Dev" folder with OneDrive instead now.

In-place upgrade for portable VSCode would really help.

Next big deal for portable use case would be bundling that should reduce the sheer number of files in the install. This was started with v1.27 where the number of files went down from ~8K to ~4K, but it needs to continue and also it would be good to insist that all extensions use webpack or similar.

I created a PowerShell script to automate the update process

```` powershell

Remove temp file from portable user data

Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

Download latest insiders build

curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/insider -o insider.zip

Delete anything except user data, update script and downloaded zip file

Get-ChildItem -Exclude @("data", "update.ps1", "insider.zip") | Remove-Item -Recurse -Force

Unzip it

Expand-Archive -Path "insider.zip" -DestinationPath .

Delete downloaded package

Remove-Item -Path "insider.zip"
Pause
````

Name it update.ps1 and place it in Code's folder. Run it when you see new version notifications.

in the case of portable zips extracting the new zip to the same folder will replace all modified content from the previous version. I have tried this couple of times and did not face any issue as such. I guess this is sort of quick and dirty way and may not be always accurate.

@vkaravind
Plus you only add or replace files, but don鈥檛 remove.

@GandalfSaxe that is right. But when you extract the new update to a different folder and open the exe it loads the data from local temp folder (generally stored under the users folder) and syncs the extensions for a while. as long as this process works fine I guess we are good.

@vkaravind

Not sure what you mean by that. You can either unzip it move all files in to the old version, which doesn鈥檛 remove files but only add/replace, or you can delete the old VSC folder and replace it with the new, which is tedious for all the reasons mentioned, for a frequently updated Insiders version.

Having the data and code in side-by-side folders (as they are for the Mac) would also help. That way I could just delete the Code folder and unzip into it, rather than having to copy the data folder elsewhere, delete the VSCode folder, extract the new zip, and then copy the data folder back in.

(Or in the case of a colleague, remove the junction point, delete the VSCode folder, unzip, recreate the junction point.)

So why Windows and Linux ZIP doesn't support auto update?
Is there any techolongy problems?

@yume-chan provided a PowerShell script but unfortunately my company disabled PowerShell execution due to security reason. Therefore I wrote a batch version for Windows to use it for my own, anyone interested can find in the link below.

https://gist.github.com/VeryCrazyDog/2f817d42f4790ba628d113885340ab6a

I created a PowerShell script to automate the update process

# Remove temp file from portable user data
Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

# Download latest insiders build
curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/insider -o insider.zip
# Delete anything except user data, update script and downloaded zip file
Get-ChildItem -Exclude @("data", "update.ps1", "insider.zip") | Remove-Item -Recurse -Force
# Unzip it
Expand-Archive -Path "insider.zip" -DestinationPath .
# Delete downloaded package
Remove-Item -Path "insider.zip"
Pause

Name it update.ps1 and place it in Code's folder. Run it when you see new version notifications.

Thank you very much!
Is it possible to update to Stable version, but not to Insiders version?

I created a PowerShell script to automate the update process

# Remove temp file from portable user data
Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

# Download latest insiders build
curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/insider -o insider.zip
# Delete anything except user data, update script and downloaded zip file
Get-ChildItem -Exclude @("data", "update.ps1", "insider.zip") | Remove-Item -Recurse -Force
# Unzip it
Expand-Archive -Path "insider.zip" -DestinationPath .
# Delete downloaded package
Remove-Item -Path "insider.zip"
Pause

Name it update.ps1 and place it in Code's folder. Run it when you see new version notifications.

Thank you very much!
Is it possible to update to Stable version, but not to Insiders version?

This script seems to be working for me (for updating only to stable versions):

# Remove temp file from portable user data
Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

# Download latest stable build
curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/stable -o stable.zip
# Delete anything except user data, update script and downloaded zip file
Get-ChildItem -Exclude @("data", "update.ps1", "stable.zip") | Remove-Item -Recurse -Force
# Unzip it
Expand-Archive -Path "stable.zip" -DestinationPath .
# Delete downloaded package
Remove-Item -Path "stable.zip"
Pause

I created a PowerShell script to automate the update process

# Remove temp file from portable user data
Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

# Download latest insiders build
curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/insider -o insider.zip
# Delete anything except user data, update script and downloaded zip file
Get-ChildItem -Exclude @("data", "update.ps1", "insider.zip") | Remove-Item -Recurse -Force
# Unzip it
Expand-Archive -Path "insider.zip" -DestinationPath .
# Delete downloaded package
Remove-Item -Path "insider.zip"
Pause

Name it update.ps1 and place it in Code's folder. Run it when you see new version notifications.

Thank you very much!
Is it possible to update to Stable version, but not to Insiders version?

This script seems to be working for me (for updating only to stable versions):

# Remove temp file from portable user data
Remove-Item -Recurse -Force -Path "data/user-data" -Include @("Backups", "Cache", "CachedData", "GPUCache", "logs")

# Download latest stable build
curl.exe -L https://vscode-update.azurewebsites.net/latest/win32-x64-archive/stable -o stable.zip
# Delete anything except user data, update script and downloaded zip file
Get-ChildItem -Exclude @("data", "update.ps1", "stable.zip") | Remove-Item -Recurse -Force
# Unzip it
Expand-Archive -Path "stable.zip" -DestinationPath .
# Delete downloaded package
Remove-Item -Path "stable.zip"
Pause

Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  234Comments

ozsay picture ozsay  路  247Comments

Tekbr picture Tekbr  路  191Comments

hsdk123 picture hsdk123  路  263Comments

Perkovec picture Perkovec  路  191Comments