Hi there,
I'm trying to reference another project of mine in my IoT Edge Solution in Visual Studio Code (C#).
Adding the reference using 'dotnet add reference' works, it recognizes the project and adds the reference to my .csproj file.
However, when I try to build the IoT Edge solution, I get the following error:
Skipping project "/project/project.csproj" because it was not found.
Hi,
that depends on the default Dockerfile. This one scopes only the current project into the build container.
You will need to adjust the COPY command inside the Dockerfile to get all projects or the whole solution into it.
I had the same issue. I solved it using a private nuget feed (from VSTS), I provide all the necessary projects from there.
Well for .NET, I found a way.
Lets say, you are at D:\Projects\MyProject. This will be referred as {somepath}
Inside this, you have {somepath}\modules{modulename} with all the Dockerfiles. Also, lets say, you have some projects such as {somepath}\coreprojects{someproject}.csproj which is being referenced into the {modulename} project.
if you try to build this inside DOCKERFILE, using VS Code, the file will not be able to get access because the context of the docker is set to the module folder access, see bold below.
docker build --rm -f "{somepath}\modules{modulename}Dockerfile.amd64" -t {someacr}/{modulename}:0.0.1-amd64 "{somepath}\modules{modulename}" ; if ($?) { docker push {someacr}/{modulename}:0.0.1-amd64 }
Thus, if we correct this to, {somepath}, which would be root for all project folders, and have the DOCKERFILE to copy like COPY . .
it will easily build the dependencies inside the docker and create image easily.
Hence the correct command should be for setting context at root folder.
docker build --rm -f "{somepath}\modules{modulename}Dockerfile.amd64" -t {someacr}/{modulename}:0.0.1-amd64 "{somepath}" ; if ($?) { docker push {someacr}/{modulename}:0.0.1-amd64 }
I hope this helps.
Does this workaround that @mbdwaj posted help?
Is this something MSTeam can fix in the code of VSCode Extension. I can see it in the extension's JS file, thus saving everyone to do this activity each time. I changed the JS code myself and reload the extension, thus it is working fine at my end.
It works! Here is the adjusted docker file that I used.
FROM microsoft/dotnet:2.1-sdk AS build-env
WORKDIR /app
COPY . .
RUN dotnet restore ./MainProject/modules/MainProject/MainProject.csproj
COPY . .
RUN dotnet publish ./MainProject/modules/MainProject/MainProject.csproj -c Release -o out
FROM microsoft/dotnet:2.1-runtime-stretch-slim-arm32v7
WORKDIR /app
COPY --from=build-env /app/MainProject/modules/MainProject/out ./
ENTRYPOINT ["dotnet", "MainProject.dll"]
And the docker command.
docker build --rm -f "{rootPath}\MainProject\modules\MainProject\Dockerfile.arm32v7" -t myacr.azurecr.io/mainproject:0.0.3-arm32v7 "{rootPath}" ; if ($?) { docker push myacr.azurecr.io/mainproject:0.0.3-arm32v7 }
Only thing for me remaining to figure out is how to change the extension file as mbdwaj suggested.
I am going to close this issue for now. Please feel free to reopen if you have questions. Thanks!
Why on earth was this closed? The work around is absurd.
Have the same issue in Visual Studio 2017 enterprise. Adding the kibernetes container reference to simple .net core project - solution built successfully. Running azure dev spaces (using vs extension tool) result in project not found. Any fix for this issue?
@HaimAudioburst, as to the issue you mentioned, is it related to VS extension IoT Edge Tools (Preview)? If yes, you may specify contextPath if module.json for module project.
Is there any Microsoft documentation created since this issue was marked as completed ? Kindly post a comment with the appropriate docx link here @myagley
Most helpful comment
Why on earth was this closed? The work around is absurd.