Reputation: 1
Following the article to build an Azure Iot Edge module on Windows 10 https://learn.microsoft.com/en-us/azure/iot-edge/tutorial-csharp-module
In the step 12 to Build IoT Edge Module, VS Code generates following error message: This is consistent experience in two different new Win 10 Environment I have tried to Build a docker image.
All the prerequisite steps have been successfully completed.
PS C:\Users\\Code\FilterModule> dotnet publish "c:\Users\\Code\FilterModule\FilterModule.csproj" Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for c:\Users\\Code\FilterModule\FilterModule.csproj... Generating MSBuild file C:\Users\\Code\FilterModule\obj\FilterModule.csproj.nuget.g.props. Restore completed in 392.82 ms for c:\Users\\Code\FilterModule\FilterModule.csproj. Program.cs(110,47): error CS0246: The type or namespace name 'TwinCollection' could not be found (are you missing a using directive or an assembly reference?) [c:\Users\\Code\FilterModule\FilterModule.csproj]
Anyone came across this issue and any advise on resolution?
Upvotes: 0
Views: 225
Reputation: 261
The tutorial walks you through the process of pasting a bunch of code into your own sample project, but it leaves out a few necessary using
directives. So if you try to compile as is, you get errors.
To work around this, you can add three using
directives to the top of your Program.cs file:
using System.Collections.Generic; // for KeyValuePair<>
using Microsoft.Azure.Devices.Shared; // for TwinCollection
using Newtonsoft.Json; // for JsonConvert
I've also submitted a PR to get the tutorial updated: https://github.com/MicrosoftDocs/azure-docs/pull/4600/files
Upvotes: 1