Create your first Windows 10 IoT background app using Visual Studio 2017: Step by step guide
Create your first Windows 10 IoT background app using Visual Studio 2017: Step by step guide
Recently, I went as a Sponsor to a .NET Code Camp and one of
the raffle prizes we brought was a Raspberry Pi kit. I was amazed at how many people wanted this
device and many of them said they already had them. They are fairly inexpensive and can be found
on a lot of websites. A few have a lot
of capabilities but for this example, you just need a very basic one. I had picked
up a Raspberry Pi soon after you could deploy Windows 10 on it and I’ve been
slowly playing with it. I thought it would be extremely helpful to show my
application logging through a cheap device as well as monitor a process I was
running on my server. Today I’m basically
using it as an email generator. I have a process where when my kids create a
new gift they want for their B-day, then I have my background process sending
an email to everyone in my family members the gift they are looking for. It’s
more for fun but I suspect you might have a true business case that you need to
monitor. For example; do you have a particular background process you need to
monitor? Maybe you need to run a
particular export report on the last date of the month? Or maybe you have a queue
and you want a background procedure to process the request.
In this Step by Step article, we will configure Visual
Studio and create the basic shell of a background application. In future articles, we’ll create code to call
a WebAPI Service. Let’s walk through the
steps to do this using Visual Studio 2017.
I am using Visual Studio 2017 Enterprise but you should be
able to complete this using the Community edition as well. To download Visual Studio, please visit https://www.visualstudio.com/vs/community/
By default, the IoT templates to create a background
application are not installed within Visual Studio. You can easily download them from the Visual
Studio marketplace.
Find the template: Windows Iot Core Project Templates for
VS 2017.
Click on the Download
button and install the templates on your computer. You should see the images
below.
After completing the new installation, you will see a new template
category called “Windows IoT Core” and you can choose the Background Application (IoT) template. Enter in your project information
or use our example below.
Create a New application
called: SampleBackgroundApp
Location: C:\Git\LunchandLearn
Solution name: LunchandLearn
When creating a Windows IoT application, you need to specify
the Target and Minimum versions of Windows that your application will support.
As Microsoft has updated Windows 10, they have enhanced the support of Windows
10 IoT as well for their devices. I initially found these options confusing but
you can use the read the different options using the link below.
For this Demo, we will be using the following settings.
After completing the initial setup, you will have a
Background app created which you can Compile and deploy to your Raspberry Pi
In a future article we’ll deploy the application to a actual
Raspberry Pi but for now we’ll run the application locally using a breakpoint at the top of the Run Method. Change the
configuration to x64 and run the program.
This code can be found on github for you to download if you
want.
Comments