In Visual studio 2017,Unable to build IoT edge module when i referencing .net core based class library in iotedge project.
See original GitHub issueExpected Behavior
Should be able to build iotedge module when referencing class library project, in visual studio 2017
Current Behavior
In Visual studio 2017,Unable to build IoT edge module when i referencing .net core based class library in iotedge project, got error message which is given below Skipping project “/IotEdgeClassLibrary/IotEdgeClassLibrary.csproj” because it was not found. Skipping project “/IotEdgeClassLibrary/IotEdgeClassLibrary.csproj” because it was not found. Restore completed in 859.82 ms for /app/IotEdgeModule.csproj. /usr/share/dotnet/sdk/2.1.802/Microsoft.Common.CurrentVersion.targets(1875,5): warning : The referenced project ‘…/IotEdgeClassLibrary/IotEdgeClassLibrary.csproj’ does not exist. [/app/IotEdgeModule.csproj] Program.cs(13,11): error CS0246: The type or namespace name ‘IotEdgeClassLibrary’ could not be found (are you missing a using directive or an assembly reference?) [/app/IotEdgeModule.csproj] The command ‘/bin/sh -c dotnet publish -c Debug -o out’ returned a non-zero code: 1 [ERROR]: Build docker image failed:The command ‘/bin/sh -c dotnet publish -c Debug -o out’ returned a non-zero code: 1
Steps to Reproduce
Provide a detailed set of steps to reproduce the bug.
- Created iotedge project in visual studio 2017 using .net core 2.1.
- Created class library in same solution using .net core 2.1
- Added reference of class library in iotedge project.
- Right clicked on the iotedge project, selected the option Build Iotedge Modules. and got error message on output window of visual studio 2017.
Context (Environment)
IDE : Visual studio 2017
OS : Azure virtual machine(Windwos 10 version 1809)
Docker/Moby [run docker version
]: 2.1.0.3
Snapshot of project structure, error message, dockerfile
Error message
DOCKER_HOST:
DOCKER_TLS_VERIFY:
DOCKER_CERT_PATH:
Additional Env Variables:
------ Build IoT Edge Modules started: Platform: Linux Amd64, Configuration: Debug ------
The deployment manifest is generated at C:\Project\AzureIotEdge\AzureIotEdgeApp\config\deployment.amd64.debug.json
docker build --rm -f "C:\Project\AzureIotEdge\IotEdgeModule\Dockerfile.amd64.debug" -t previewacr.azurecr.io/iotedgemodule:0.0.1-amd64.debug "C:\Project\AzureIotEdge\IotEdgeModule"
Sending build context to Docker daemon 668.2kB
Step 1/15 : FROM microsoft/dotnet:2.1-runtime-stretch-slim AS base
---> 43005d15cfda
Step 2/15 : RUN apt-get update && apt-get install -y --no-install-recommends unzip procps && rm -rf /var/lib/apt/lists/*
---> Using cache
---> aee8bbf234b6
Step 3/15 : RUN useradd -ms /bin/bash moduleuser
---> Using cache
---> 5ee8caa96715
Step 4/15 : USER moduleuser
---> Using cache
---> 3062483c6592
Step 5/15 : RUN curl -sSL https://aka.ms/getvsdbgsh | bash /dev/stdin -v latest -l ~/vsdbg
---> Using cache
---> a1e434090582
Step 6/15 : FROM microsoft/dotnet:2.1-sdk AS build-env
---> bf77a711b92c
Step 7/15 : WORKDIR /app
---> Using cache
---> c70a58309537
Step 8/15 : COPY *.csproj ./
---> Using cache
---> dcf50d920034
Step 9/15 : RUN dotnet restore
---> Using cache
---> 4117095b00bd
Step 10/15 : COPY . ./
---> Using cache
---> 392a1fe535f6
Step 11/15 : RUN dotnet publish -c Debug -o out
---> Running in d3384e97e8df
Microsoft (R) Build Engine version 16.2.32702+c4012a063 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Skipping project "/IotEdgeClassLibrary/IotEdgeClassLibrary.csproj" because it was not found.
Skipping project "/IotEdgeClassLibrary/IotEdgeClassLibrary.csproj" because it was not found.
Restore completed in 859.82 ms for /app/IotEdgeModule.csproj.
/usr/share/dotnet/sdk/2.1.802/Microsoft.Common.CurrentVersion.targets(1875,5): warning : The referenced project '../IotEdgeClassLibrary/IotEdgeClassLibrary.csproj' does not exist. [/app/IotEdgeModule.csproj]
Program.cs(13,11): error CS0246: The type or namespace name 'IotEdgeClassLibrary' could not be found (are you missing a using directive or an assembly reference?) [/app/IotEdgeModule.csproj]
The command '/bin/sh -c dotnet publish -c Debug -o out' returned a non-zero code: 1
[ERROR]: Build docker image failed:The command '/bin/sh -c dotnet publish -c Debug -o out' returned a non-zero code: 1
Additional Information
Please provide any additional information that may be helpful in understanding the issue.
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
This error is because your dotnet publish command cannot find the project file in the root folder. To help you better understanding how to change the Dockfile, here is a sample docker file you can refer:
I aslo created a sample project, you can find it here: SampleEdgeProjectWithCSharpLibary.zip
You can also refer troubleshoot page:
https://github.com/Microsoft/vs-azure-iot-edge-docs/wiki/Troubleshoot#4-docker-build-fails---when-reference-libraryshared-code-in-projectsolution