ScriptKidding
ScriptKidding
CC#
Created by ScriptKidding on 3/24/2024 in #help
✅ Error while Dockerizing an ASP.NET project which references another project.
I am always hit with this error
=> ERROR [publish 1/1] RUN dotnet publish "ScoreManagementAPI.csproj" -c Release ./publish
------
> [publish 1/1] RUN dotnet publish "ScoreManagementAPI.csproj" -c Release ./publish:
0.642 MSBuild version 17.9.6+a4ecab324 for .NET
0.647 MSBUILD : error MSB1008: Only one project can be specified.
0.647 Full command line: '/usr/share/dotnet/sdk/8.0.203/MSBuild.dll -maxcpucount -verbosity:m -restore -target:Publish --property:_IsPublishing=true -property:Configuration=Release -property:DOTNET_CLI_DISPUBLISH_AND_PACK_RELEASE=true ScoreManagementAPI.csproj ./publish -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/share/dotnet/sdk/8.0.203/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildrdingLogger,/usr/share/dotnet/sdk/8.0.203/dotnet.dll'
0.647 Switches appended by response files:
0.647 Switch: ./publish
------
Dockerfile:25
--------------------
23 | # Publish the application
24 | FROM build as publish
25 | >>> RUN dotnet publish "ScoreManagementAPI.csproj" -c Release ./publish
26 |
27 | ENTRYPOINT [ "ls", "/src/Entities" ]
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet publish \"ScoreManagementAPI.csproj\" -c Release ./publish" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/default/default/ldjohf1twrrr0ulw9vu5jbcax
=> ERROR [publish 1/1] RUN dotnet publish "ScoreManagementAPI.csproj" -c Release ./publish
------
> [publish 1/1] RUN dotnet publish "ScoreManagementAPI.csproj" -c Release ./publish:
0.642 MSBuild version 17.9.6+a4ecab324 for .NET
0.647 MSBUILD : error MSB1008: Only one project can be specified.
0.647 Full command line: '/usr/share/dotnet/sdk/8.0.203/MSBuild.dll -maxcpucount -verbosity:m -restore -target:Publish --property:_IsPublishing=true -property:Configuration=Release -property:DOTNET_CLI_DISPUBLISH_AND_PACK_RELEASE=true ScoreManagementAPI.csproj ./publish -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/share/dotnet/sdk/8.0.203/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildrdingLogger,/usr/share/dotnet/sdk/8.0.203/dotnet.dll'
0.647 Switches appended by response files:
0.647 Switch: ./publish
------
Dockerfile:25
--------------------
23 | # Publish the application
24 | FROM build as publish
25 | >>> RUN dotnet publish "ScoreManagementAPI.csproj" -c Release ./publish
26 |
27 | ENTRYPOINT [ "ls", "/src/Entities" ]
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet publish \"ScoreManagementAPI.csproj\" -c Release ./publish" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/default/default/ldjohf1twrrr0ulw9vu5jbcax
Anyone knows why ? please help. Also i executed the build command by standing at the Backend folder then running the following line
docker build -t score -f .\ScoreManagementAPI\Dockerfile .
docker build -t score -f .\ScoreManagementAPI\Dockerfile .
13 replies