The compile fails with the following:
1>Step 7/16 : RUN dotnet restore -nowarn:msb3202,nu1503
1> ---> Running in 7b165cda3f88
1>/usr/share/dotnet/sdk/2.1.101/NuGet.targets(229,5): error MSB3202: The project file "/src/docker-compose.dcproj" was not found. [/src/DockerTest.sln]
1>Service 'dockertest' failed to build: The command '/bin/sh -c dotnet restore -nowarn:msb3202,nu1503' returned a non-zero code: 1
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets(111,5): error : Building dockertest
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets(111,5): error : Service 'dockertest' failed to build: The command '/bin/sh -c dotnet restore -nowarn:msb3202,nu1503' returned a non-zero code: 1.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets(111,5): error :
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.Docker.targets(111,5): error : For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting
The same error can also be reproduced in any build that attempts to build the docker image, including running docker build locally and on CI services such as Docker Cloud.
There will also be additional errors about further missing .csproj files for each additional project in the solution, e.g. unit test projects.
This error was caused by changes in NuGet between the 2.1.4 and 2.1.101 SDK. We are working on a hotfix to the aspnet-docker image which includes a workaround for this error. (see https://github.com/aspnet/aspnet-docker/pull/389). In the long-run, we hope to eliminate the need to suppress MSB3202 (see #87)
In the meantime, you can apply this workaround locally to unblock your builds. Change any lines with dotnet restore to this:
dotnet restore -nowarn:msb3202,nu1503 -p:RestoreUseSkipNonexistentTargets=false
Adding RestoreUseSkipNonexistentTargets reverts NuGet to its previous behavior, in which MSB3202 is a warning which can be suppressed.
I'm having this issue in Visual Studio 15.7.4 as well.
This issue is being closed as an inactive issue. If you wish to keep it active, please reply with any additional context for our consideration, we are happy to take a look!
Hi Team,
I am facing this issue when creating the image.
Please look into this and let me know .
C:Program Filesdotnetsdk2.1.700NuGet.targets(121,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:srcLearnDockerLearnDocker.csproj]
C:Program Filesdotnetsdk2.1.700NuGet.targets(121,5): error : A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [C:srcLearnDockerLearnDocker.csproj]
The command 'cmd /S /C dotnet restore "LearnDocker/LearnDocker.csproj"' returned a non-zero code: 1
FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-1709 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.1-sdk-nanoserver-1709 AS build
WORKDIR /src
COPY ["LearnDocker/LearnDocker.csproj", "LearnDocker/"]
RUN dotnet restore -nowarn:msb3202,nu1503 -p:RestoreUseSkipNonexistentTargets=false "LearnDocker/LearnDocker.csproj"
COPY . .
WORKDIR "/src/LearnDocker"
RUN dotnet build "LearnDocker.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "LearnDocker.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "LearnDocker.dll"]
@DotsYatin It seems like your container may have some networking issue in accessing NuGet.org. Sometimes restarting Docker Desktop fixes this?
Facing similar issue. Restarting and re-installing Docker Desktop had no effect. https://api.nuget.org/v3/index.json is accessible via browser. I am also able to run "dotnet restore" on my project successfully.
I will appreciate any help.
Error
C:Program Filesdotnetsdk2.2.301NuGet.targets(121,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:srcContaineredWebApp.csproj]
C:Program Filesdotnetsdk2.2.301NuGet.targets(121,5): error : No such host is known [C:srcContaineredWebApp.csproj]
The command 'cmd /S /C dotnet restore -nowarn:msb3202,nu1503 -p:RestoreUseSkipNonexistentTargets=false "ContaineredWebApp.csproj"' returned a non-zero code: 1
Dockerfile
FROM microsoft/dotnet:2.2-aspnetcore-runtime-nanoserver-1803 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM microsoft/dotnet:2.2-sdk-nanoserver-1803 AS build
WORKDIR /src
COPY ["ContaineredWebApp.csproj", "ContaineredWebApp.csproj"]
RUN dotnet restore -nowarn:msb3202,nu1503 -p:RestoreUseSkipNonexistentTargets=false "ContaineredWebApp.csproj"
COPY . .
WORKDIR "/src"
RUN dotnet build "ContaineredWebApp.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "ContaineredWebApp.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ContaineredWebApp.dll"]
@dukefox11 Is the result the same from the command line if you do "docker build"?
EDIT: It could be related to proxy settings, like in here: https://github.com/NuGet/Home/issues/2880
I was also experiencing the same issue. Used the -nowarn:msb3202,nu1503 -p:RestoreUseSkipNonexistentTargets=false flags to resolve the problem. Using Microsoft Visual Studio Enterprise 2019 - Version 16.9.5
Most helpful comment
This error was caused by changes in NuGet between the 2.1.4 and 2.1.101 SDK. We are working on a hotfix to the aspnet-docker image which includes a workaround for this error. (see https://github.com/aspnet/aspnet-docker/pull/389). In the long-run, we hope to eliminate the need to suppress MSB3202 (see #87)
In the meantime, you can apply this workaround locally to unblock your builds. Change any lines with
dotnet restoreto this:Adding RestoreUseSkipNonexistentTargets reverts NuGet to its previous behavior, in which MSB3202 is a warning which can be suppressed.