VS Code Setup For Windows Thumbnail

Using Visual Studio Code With Raspberry Pi Network Share [Windows]


Just like the previous tutorial, we setup Visual Studio Code Raspberry Pi on our Mac, this tutorial describes the process of setting Visual Studio Code up on Windows for use with the Raspberry Pi.

I won’t duplicate information and state the steps to install VS Code and the plugins, they can be found here. We will jump straight into setting up a network share on our Pi so we can access it from our Windows Machine.

Setting up a Network Share

To allow Windows PCs to view shared folders on the Raspberry Pi, we must install Samba. Just like we did with Netatalk for the Mac, we will use the Raspbian apt-get package manager to do so.

First thing you want to do is log in via SSH to your Pi so we can install Samba and edit its config files.

To install Samba we need to install the package “Samba” and also an additional package known as “samba-common-bin”. Luckily, we can do this in one command (because we’re too lazy to do it twice, right?)

> sudo apt-get install samba samba-common-bin

If you are prompted to confirm install, type “Y” and hit enter.

Edit Samba Config

Unlike setting up a network share via Netatalk, we must edit the config file for Samba to tell it what folders we would like to share and what permissions we should allow.

To edit the config file simply open it in the Nano Text Editor by entering the following:

> sudo nano /etc/samba/smb.conf

Before we state what folders we want to share, we must first ensure that samba is to have Windows support enabled and to specify the workgroup our network is on.

To enable this, we must set the following:

workgroup = WORKGROUP
wins support = yes

You must ensure that there is no “#” in front of these lines, as this is a comment and will result in the setting being ignored. It’s also worth mentioning that your workgroup name may differ. This guide shows you how to view the workgroup name

As an example, here are the settings on my Pi

Samba Workgroup Settings Image
Samba Workgroup Settings

The final step is to let Samba know what folders we want to share. To do so, simply scroll to the bottom of your file using the arrow keys on your keyboard and enter the following (changing the locations to what you require).

[pihome] # Name of share in network locations
    comment="share location containing code files"
    path=/home/pi # Location to the folder we want to share
    browseable=yes # Folder is visible in network
    writeable=yes # We can create files
    only guest=no # Username and password required
    create mask=0777 # permissions for creating files
    directory mask=0777 # permissions for directory
    public=no # remote access

Save the file by pressing “ctrl + X” then hitting “Y” to confirm.

Creating a Samba User

Unfortunately, Samba doesn’t use the Pis username and password by default. We have to tell Samba the username and password for the users we want to allow access. To do this, we must enter the following in the terminal

> sudo smbpasswd -a pi

It will then prompt you to enter (and again to confirm) the password for the user “pi” we just created.

Testing the Network Share

Now that we have created the shared directory and created a username and password we can go back to our windows machine and go to our network places. You should see your Raspberry Pi appear in your network. For me, my pi is called “RASPBERRYPI”

Raspberry Pi on Windows Network Image
Raspberry Pi on Windows Network
Upon double clicking your Pis network share, you will be prompted for a username and password. Simply enter the details you created in the “Creating a Samba User” section of this tutorial and you should then be able to see your shared locations!
Pi Shared Folders on Windows Network Image
Pi Shared Folders on Windows Network

Using Visual Studio Code

Now that we have Visual Studio Code installed on our PC, and have access to the Pis home directory (where we save our scripts) we can start to edit our code!

Simply drag a file from the Raspberry Pi network share into Visual Studio Code. Any changes you make and save will be updated on the Pi itself.

Alternatively, you can open a folder from within Visual Studio code by clicking “file -> open folder” and navigating to the folder on the Pi that you want to open.

Happy Intellisense!

Published by


Nick Cullen is a software developer living in South Wales, UK. He is primarily focused around coding in C++ and C# and loves tinkering with new programming languages and technologies. A key technological interest of his is Mobile Development mainly in Xamarin and most recently using Flutter and Dart. Through this interest, he has released one app so far: Prog on both iOS and Android

2 thoughts on “Using Visual Studio Code With Raspberry Pi Network Share [Windows]”

  1. Nice article! I would suggest reminding readers to enable SMB file sharing(control panel ->programs and features->additional features) on their windows​ machine. Also, I think you may have a typo in your share configuration; create make 0777 instead of create mask 0777.

    1. Great spot! I’ll update this next time I’m at the laptop 🙂 thanks!

      I’ve not come across the SMB file sharing option on windows before. Is this off by default? Can’t say I’ve had issues with how I did my setup as per my post without editing that setting?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.