Continue using Hyper-V container for IoT Edge on Windows 10 1803

Xin Shi

Xin

With Azure IoT Edge 1.0.5 release, developers should use process isolation container to build and run IoT Edge modules for Windows 1809 (Windows 10 October 2018 Update) IoT Edge device. And Azure IoT Edge tools for Visual Studio and Azure IoT Edge for Visual Studio Code also updated its default project template to align with 1809 requirements. You can follow the tutorials for VS or VS Code to build 1809 C# module with the dockerfile.windows-amd64 in the module folder. However, if you still want to use Hyper-V container for Windows 1803 (or before) IoT Edge device. Here comes the instructions.

Continue developing IoT Edge 1803 module in Visual Studio Code

Before started, making sure you have installed 1.7.0 (or after) version of Azure IoT Edge for Visual Studio Code. Follow the instructions below to stick with IoT Edge 1.0.4 and 1803 module templates.

  1. Open a new VS Code window, in Commend Palette, type and open Preferences: Open Settings.
  2. Navigate to Extensions -> Azure IoT Edge configuration.
  3. Make sure you have checked Template Install for all the options. By doing this, VS Code will automatically install your specified version of the module template.
  4. Specify the module template version so that you can stick to 1803 module project template. You can update the value for all the templates or just update the template you want to use.
    1. C# function module template – 3.0.1
    2. C# custom module template – 2.3.0
    3. Java custom module template – 1.2.0
    4. Node custom module template, run npm i -g generator-azure-iot-edge-module@1.2.0 in the terminal
  5. Make sure your Edge Agent and Edge Hub versions are 1.0.4.

After doing that, each time when creating a new solution or adding a new module for 1803, you will get 1.0.4 for your EdgeHub and EdgeAgent in your .template.json and 1803 base image the dockerfile.windows-amd64.

Once you decide to move to 1809, just delete the version numbers you’ve specified in the settings and create new solution or add a new module.

Continue developing IoT Edge 1803 module in Visual Studio 2017

Azure IoT Edge tools for Visual Studio (Preview) has updated the C# template to use 1809 images. If you still want to develop and deploy 1803 C# module. Follow the instructions below to handle the version number and base image manually.

  1. Open Dockerfile.windows-amd64, update the base image from microsoft/dotnet:2.1-runtime-nanoserver-1809 to microsoft/dotnet:2.1-runtime-nanoserver-1803.

  2. Open deployment.template.json file, update the version number for EdgeHub and EdgeAgent from 1.0 to 1.0.4.

Once to decide to move to 1809, use 1809 base image and 1.0 for your Edge runtime in your existing projects. All newly created projects will use 1809 template by default.

Xin Shi
Xin Shi

Program Manager II, Azure IoT Developer Experience

Follow Xin   

0 comments

Comments are closed.