This page explains how to set up the TinyCLR programming environment. It covers device and computer setup and deployment of a "hello world" program.
If you're an existing user of NETMF and still want to use it in addition to TinyCLR OS, don't worry. TinyCLR is completely independent of NETMF and works side-by-side with no issues.
TinyCLR Device Setup
To use TinyCLR with a device you must first install the latest versions of the GHI bootloader and TinyCLR firmware on the device. The bootloader is installed first and provides a way to install the firmware and to execute programs which are uploaded to the device.
The TinyCLR firmware includes the Common Language Runtime (CLR) which converts compiled code into machine instructions and manages program execution. The TinyCLR firmware is also responsible for interacting with Microsoft Visual Studio to load and debug your application programs.
Instructions for installing the bootloader and firmware are provided on the documentation page for each device. If you want to use your own device, visit our porting guide for information on how to get started.
TinyCLR Computer Setup
Download and Install Visual Studio and the TinyCLR Extension
- If you don't already have Visual Studio 2017, download and install the free version from here: Visual Studio Community 2017.
- Make sure to select the
.NET desktop developmentworkload when installing Visual Studio.
Download and install the newest TinyCLR Visual Studio Project System by going to
Extensions and Updates.... In the
Extensions and Updatesdialog box select
Onlinein the left panel. Type
Searchtext box in the upper right of the window to search for and install the
TinyCLR OS Project System. You'll need to restart Visual Studio to let the extension installer complete the installation.
Install the TinyCLR Nuget Packages
- Connect your device to your PC using a USB cable (make sure your device has the latest firmware installed).
- Start Visual Studio and create a new
C# > TinyCLR. New to Visual Studio or C#? Take a look at the getting started guide from Microsoft.
Right click on your Project in the Solution Explorer panel and select
Manage NuGet Packages. If the Solution Explorer window is not visible, open it by selecting
Solution Explorerin the
Viewmenu. You can also select
Manage NuGet Packages...in the
Projectmenu of Visual Studio.
Make sure the package source is set to "Package source" or "All."
In the search box type "tinyclr"
Browsetab will show all the TinyCLR NuGet packages. Those installed are noted with a green down arrow in front of the name.
To install one of the packages click on the down arrow to the right of the package version.
You can also select the package and click on the
Install button in the center panel.
OKto accept the proposed changes.
Accept the licensing agreement to install the package.
And, that's it! You're now ready to start programming using TinyCLR OS.
Starting a New Project
Let's make a "hello world" program and deploy it on the FEZ Cobra III.
Open Visual Studio and select
File > New > Project.
There should be a
TinyCLR option under
Visual C#. Click on
TinyCLR in the left panel, and
TinyCLR Application in the center panel. Name the project and hit the
OK button to create a new project.
The project will have a single C# file named
Program.cs whose contents are shown below.
C# source files are listed in the
Solution Explorer window. If the
Solution Explorer window is not visible, click on
View > Solution Explorer to open it.
If you right click on the project name in the Solution Explorer window, a drop down menu will appear. Select
Manage NuGet Packages... from the menu.
Now you should see the installed TinyCLR NuGet library (GHIElectronics.TinyCLR.Core). This is the only library we will need for our "hello world" program.
NuGet... tab or click on the
Program.cs tab to edit the source code. Change the contents as shown below.
Make sure your device is plugged into the computer's USB port. Now hit the start button as shown on the above image (or hit the
F5 key). If you've done everything correctly the program will compile and deploy to your device. The message "Hello World!" should appear in the output window as shown below.
Congratulations! You're on your way to becoming a TinyCLR embedded developer!
To learn more about TinyCLR embedded programming check out our tutorials.