I'm attempting to build a container on a build server on Windows Server 2019, however it keeps failing at the dotnet restore step with the message 'The command '/bin/sh -c dotnet restore "..." returned a non-zero code: 4294967295'. I have been running this manually on the build server while troubleshooting in case there are any issues with the pipeline, but it still fails with the same error.
If anyone is wondering, we are using windows containers/build servers as that is a requirement coming from our IT team.
I'm using the dockerfile generated by visual studio. The build works fine locally when I have docker desktop set to run windows containers. Including it below (i've simplified some of the file paths)
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 8000
ENV ASPNETCORE_URLS=http://*:8000
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Services/myService.API.csproj", "Services/myService.API/"]
COPY ["Services/myService.DAL.csproj", "Services/myService.DAL/"]
COPY ["BuildingBlocks/BuildingBlocks.csproj", "BuildingBlocks/"]
RUN dotnet restore "Services/myService.API.csproj"
COPY . .
WORKDIR "/src/Services/myService.API"
RUN dotnet build "myService.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "myService.API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "myService.API.dll"]
I see a lot of the issues with this error code seem to be connected to WSL and hyper-v, so I confirmed both are installed, however since we are using windows images I am not sure why that would be needed here.
Has anyone encountered this or have any ideas as to what might be causing the issue?
Steps I've taken so far:
The issue seems to be resolved now. We upgraded to Windows Server 2022 and re-installed docker and the build is now succeeding.