Azure IoT - Deploy SQL Server module: Build and Push IoT Edge solution --> ERROR [build-env 6/6] RUN dotnet publish

DataSciencentist2021 141 Reputation points
2021-11-29T11:22:18.79+00:00

Hi everyone,

I am currently trying to deploy a SQL Server module to store data on a device running Azure IoT Edge with Linux container following the official tutorial (https://learn.microsoft.com/en-us/azure/iot-edge/tutorial-store-data-sql-server?view=iotedge-2020-11).

Unfortunately there seem to be some problems:

  1. There is no file named "sqlFunction.cs" ( I just used the file "Program.cs" and renamed it).
  2. Wenn I try to "Build and Push" the IoT Edge solution the following error regarcing the "sqlFunction.cs"-file occurs:

    => ERROR [build-env 6/6] RUN dotnet publish -c Release -o out 7.1s

    [build-env 6/6] RUN dotnet publish -c Release -o out:

    13 1.311 Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET

    13 1.311 Copyright (C) Microsoft Corporation. All rights reserved.

    13 1.311

    13 2.312 Determining projects to restore...

    13 4.407 Restored /app/sqlFunction.csproj (in 1.32 sec).

    13 7.021 sqlFunction.cs(7,23): error CS0234: The type or namespace name 'WebJobs' does not exist

    in the namespace 'Microsoft.Azure' (are you missing an assembly reference?) [/app/sqlFunction.csproj]

    13 7.021 sqlFunction.cs(8,23): error CS0234: The type or namespace name 'WebJobs' does not exist

    in the namespace 'Microsoft.Azure' (are you missing an assembly reference?) [/app/sqlFunction.csproj]

    13 7.021 sqlFunction.cs(9,23): error CS0234: The type or namespace name 'WebJobs' does not exist

    in the namespace 'Microsoft.Azure' (are you missing an assembly reference?) [/app/sqlFunction.csproj]

    13 7.022 sqlFunction.cs(18,10): error CS0246: The type or namespace name 'FunctionNameAttribute'

    could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    13 7.022 sqlFunction.cs(18,10): error CS0246: The type or namespace name 'FunctionName' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    13 7.023 sqlFunction.cs(21,47): error CS0246: The type or namespace name 'IAsyncCollector<>' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    13 7.023 sqlFunction.cs(20,14): error CS0246: The type or namespace name 'EdgeHubTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    13 7.023 sqlFunction.cs(20,14): error CS0246: The type or namespace name 'EdgeHubTrigger' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    13 7.023 sqlFunction.cs(21,14): error CS0246: The type or namespace name 'EdgeHubAttribute' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    13 7.023 sqlFunction.cs(21,14): error CS0246: The type or namespace name 'EdgeHub' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    #13 7.023 sqlFunction.cs(21,22): error CS0246: The type or namespace name 'OutputName' could not be found (are you missing a using directive or an assembly reference?) [/app/sqlFunction.csproj]

    executor failed running [/bin/sh -c dotnet publish -c Release -o out]: exit code: 1

I could not find any suitable solution in the web.

Do you have any suggestions on how to solve this issue? :)

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
561 questions
{count} vote

Accepted answer
  1. Matthijs van der Veer 4,376 Reputation points MVP
    2021-12-02T13:17:03.05+00:00

    I was following the same tutorial to see where things might have gone wrong, and I think I found out what's going on. By mistake I selected "C# Module" instead of "Azure Functions - C#" when selecting the module template. When you do that, you end up with a Program.cs file like you described. Could you try the tutorial again from scratch, and make sure you have the right template selected?

    The module template options

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful