I am creating a CI pipeline in Azure for a .NetCore 3.1 application and adding Docker "buildandpush" tasks. i have 2 cases, if i run only .Netcore tasks (restore, build, test, publish) my build success With out any error, if i disable above .NetCore tasks and run only docker(buildAndpublish) Tasks my build success and image pushed into my ACR, but if I enable above .NetCore tasks along with Docker tasks throw an error here.
Can any one tell me the Build definition of .netCore tasks, is i am doing the right things.
ERROR
C:\Program Files\dotnet\sdk\3.1.100\NuGet.targets(123,5): error : Access to the path 'C:\src\RINWeb\obj\RINMVC.csproj.nuget.dgspec.json' is denied. [C:\src\RINWeb\RINMVC.csproj]
Build FAILED.
C:\Program Files\dotnet\sdk\3.1.100\NuGet.targets(123,5): error : Access to the path 'C:\src\RINWeb\obj\RINMVC.csproj.nuget.dgspec.json' is denied. [C:\src\RINWeb\RINMVC.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:01.34 The command 'cmd /S /C dotnet build "RINMVC.csproj" -c Release -o /app/build' returned a non-zero code: 1
[error]The process 'C:\Program Files\Docker\docker.exe' failed with exit code 1
My docker file is:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 AS build
WORKDIR /src
#####COPY ["RINWeb/RINMVC.csproj", "RINWeb/"]
COPY ["RINMVC.csproj", "RINWeb/"]
RUN dotnet restore "RINWeb/RINMVC.csproj"
#####COPY . .
COPY . RINWeb/
WORKDIR "/src/RINWeb"
RUN dotnet build "RINMVC.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "RINMVC.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "RINMVC.dll"]

