Work on Meadow using Visual Studio Code

Hello Meadow developers,

In this post, I want to show you how to use the Meadow Extension for Visual Studio Code.

Installation

  1. Download the extension .vsix file from the latest GitHub release.
  2. Click File -> Preferences -> Extensions.
  3. In the Extensions tab , click the ... menu and choose Install from VSIX….
  4. Pick the file you downloaded to install.

Create a new project

In the terminal:

  1. Run dotnet new -i WildernessLabs.Meadow.Template to load all the project and library templates. Notice you can create Meadow Applications (parameter Meadow) and Libraries (parameter MeadowDll) in C# (default), F# and VB.NET
  1. Create and/or navigate into a directory with the name of your new app (ie: blinky).
  2. Open the project directory in VS Code
  3. Run dotnet new Meadow to create a Meadow Application in C#. Once created, click the Restore button to restore the Meadow.Foundation NuGet package.

Build and Deploy

IMPORTANT – macOS Users: You will need to set omnisharp.useGlobalMono to always in VSCode’s settings (ie: "omnisharp.useGlobalMono": "always") since the MSBuild that ships embedded with VSCode on macOS does not know how to find the .NET 4.7.2 targeting packs (reference assemblies). This setting might need to be reverted if you want to build .NET Core projects in other solutions.

  1. Open your new app’s directory in VSCode.
  2. Click Run -> Add Configuration and in the list of Environment choose Meadow
  1. Ensure your Meadow board is plugged in, and up to date.
  2. Choose Run -> Start Debugging (Your code will automatically be built first).
  3. If prompted, pick the serial port of your Meadow board.
  1. Watch the output and Meadow’s onboard RGB LED turn on and change colors!

References