【VSCode】VSCodeで”wsl$”配下のフォルダを開く際に毎回警告が出るのを回避する方法
現象
Visual Studio Codeで"wsl$"配下のフォルダを開くと、毎回以下のような警告が表示される。
![](https://programming.sincoston.com/wp-content/uploads/2023/05/image-9.png)
[Window Title]
Visual Studio Code
[Main Instruction]
The host 'wsl.localhost' was not found in the list of allowed hosts. Do you want to open it anyway?
[Content]
The path '\\wsl.localhost\Ubuntu\tmp' uses a host that is not allowed. Unless you trust the host, you should press 'No'
[Yes] [No] [Learn More]
毎回、"Yes"を選択すれば通常通り、VSCodeを開けるのだが、毎回めんどくさいので、この警告が表示されないようにする方法を紹介する。
※ちなみに、version 1.78.1からUNC パス (先頭が\\で始まるパス)でこのような警告がでるようになったらしい
解決方法
1.VSCodeの設定を開く(ファイル→ユーザー設定→設定)
![](https://programming.sincoston.com/wp-content/uploads/2023/05/image-10.png)
2.セキュリティの項目を開く
![](https://programming.sincoston.com/wp-content/uploads/2023/05/image-11-1024x425.png)
3."項目の追加"ボタンを押下
![](https://programming.sincoston.com/wp-content/uploads/2023/05/image-12-1024x252.png)
4."wsl$"と"wsl.localhost"と入力して"OK"を押下
(よくわからないが、警告のメッセージ内のパスが"wsl$"だったり、"wsl.localhost"だったりするので両方入れとく)
![](https://programming.sincoston.com/wp-content/uploads/2023/05/image-15-1024x288.png)
5.VSCodeの再起動を求められるので再起動する。
![](https://programming.sincoston.com/wp-content/uploads/2023/05/image-14.png)
6.これで、"wsl$"と"wsl.localhost"配下のフォルダを開くときには警告は表示されなくなる。
ディスカッション
コメント一覧
まだ、コメントがありません