Build error while creating Image from Dockerfile

Hi, I am trying to build the Image from Dockerfile but getting the below errors. I am not using Docker Desktop. I have cloned the repository directly into the build machine and created a Dockerfile for one simple Module.

Dockerfile looks like:
FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build
WORKDIR /app
EXPOSE 80
EXPOSE 443

COPY *.csproj .

#COPY Client/* ./Client/
#COPY Domain/* ./Domain/
#COPY Facade/* ./Facade/
#COPY Localization/* ./Localization/
#COPY Process/* ./Process/
#COPY S3.VO.Delegering.ServicesContract/* ./S3.VO.Delegering.ServicesContract/
#COPY S3.VO.Delegering.ServicesImpl/* ./S3.VO.Delegering.ServicesImpl/
#COPY Starter/* ./Starter/
#COPY ViewModels/* ./ViewModels/
RUN dotnet restore “S3.VO.Delegering.Client.csproj”

COPY . .

WORKDIR /app
RUN dotnet publish -c Release -o out --no-restore

FROM mcr.microsoft.com/dotnet/framework/runtime:4.8 AS runtime
WORKDIR /app
COPY --from=publish /app/out ./
ENTRYPOINT [“dotnet”, “S3.VO.Delegering.Client.dll”]

Errors:

Step 6/13 : RUN dotnet restore “S3.VO.Delegering.Client.csproj”
—> Running in 15fb0c1f7351
Determining projects to restore…
Skipping project “C:\Common\Components\Gui\Source\General.Components.Gui\General.Components.Gui.csproj” because it was not found.
Skipping project “C:\Behorighet\Source\ServicesContract\S3.Behorighet.BehorighetServicesContract.csproj” because it was not found.
Skipping project “C:\Common\Components\Gui\Source\S3.Common.Components.Gui\S3.Common.Components.Gui.csproj” because it was not found.
Skipping project “C:\Common\Components\Utils\Source\Help\S3.Common.Components.Utils.Help.csproj” because it was not found.
Skipping project “C:\Common\Components\Utils\Source\S3.Common.Components.Utils\S3.Common.Components.Utils.csproj” because it was not found.
Skipping project “C:\Common\Core\Source\Core\S3.Common.Core.csproj” because it was not found.
Skipping project “C:\Domain\S3.VO.Delegering.Domain.csproj” because it was not found.
Skipping project “C:\Facade\S3.VO.Delegering.Facade.csproj” because it was not found.
Skipping project “C:\S3.VO.Delegering.ServicesContract\S3.VO.Delegering.ServicesContract.csproj” because it was not found.
Skipping project “C:\Common\Components\Gui\Source\General.Components.Gui\General.Components.Gui.csproj” because it was not found.
Skipping project “C:\Behorighet\Source\ServicesContract\S3.Behorighet.BehorighetServicesContract.csproj” because it was not found.
Skipping project “C:\Common\Components\Gui\Source\S3.Common.Components.Gui\S3.Common.Components.Gui.csproj” because it was not found.
Skipping project “C:\Common\Components\Utils\Source\Help\S3.Common.Components.Utils.Help.csproj” because it was not found.
Skipping project “C:\Common\Components\Utils\Source\S3.Common.Components.Utils\S3.Common.Components.Utils.csproj” because it was not found.
Skipping project “C:\Common\Core\Source\Core\S3.Common.Core.csproj” because it was not found.
Skipping project “C:\Domain\S3.VO.Delegering.Domain.csproj” because it was not found.
Skipping project “C:\Facade\S3.VO.Delegering.Facade.csproj” because it was not found.
Skipping project “C:\S3.VO.Delegering.ServicesContract\S3.VO.Delegering.ServicesContract.csproj” because it was not found.
Nothing to do. None of the projects specified contain packages to restore.
Removing intermediate container 15fb0c1f7351
—> 21b0dca74271
Step 7/13 : COPY . .
—> 593347e5af75
Step 8/13 : WORKDIR /app
—> Running in 34e5446982e0
Removing intermediate container 34e5446982e0
—> 785623677e05
Step 9/13 : RUN dotnet publish -c Release -o out --no-restore
—> Running in ccab4c0f5f85
MSBuild version 17.7.3+8ec440e68 for .NET
C:\app\s3.vo.delegering.client.csproj(57,3): error MSB4019: The imported project “C:\Build\TreservaGlobal.targets” was not found. Confirm that the expression in the Import declaration “…........\Build\TreservaGlobal.targets” is correct, and that the file exists on disk.
The command ‘cmd /S /C dotnet publish -c Release -o out --no-restore’ returned a non-zero code: 1

Any suggestions.

Thanks.

Well, it seems some files are not found.

Maybe because some COPY commands were commented out.

Maybe because you are seemingly running Docker in Linux (Docker Desktop on Windows usually runs containers in a Linux VM) and there are Windows paths in a config file.

Hi,
I am running the Docker in Windows server only not in Linux VM. I am not using Docker Desktop as well. I just installed Docker Engine on my Windows server 2022 and trying to build the Images.

Thanks,
Hari

I don’t think this order makes sense.

Copy files to image first, then run command on them.

okay, let me try in that way