Portable ModeのVSCodeをアップデート

問題

  • Portable Mode版のVSCodeはインストーラー版と違って自動アップデートが使えない
  • したがって、簡易なアップデートが可能なように以下の手順、スクリプトがGitHubコミュニティで提案されている

スクリプト - Windows

update.ps1 ファイル

 # 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://code.visualstudio.com/sha/download?build=stable&os=win32-x64-archive" -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

update.ps1の実行

 > .\update.ps1
  • 上のスクリプトをVSCodeの実行ファイル(code.exe)がある場所にupdate.ps1というファイル名で保存する
  • VSCodeをアップデートしたい時はこのスクリプトを実行する
  • なお、このスクリプトはdataフォルダ以下のユーザー設定や拡張機能ファイルを除く、すべてのファイルを削除する。なので、心配なら事前にVSCodeの入ったフォルダーごとバックアップしておくといい

参考

https://github.com/microsoft/vscode/issues/56326


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2021-07-23 (金) 10:18:15