I am building an ASP.NET Core 8.0 application for arm64 via a github action. Upon the dotnet restore
command, the error in the title is thrown and the build process is aborted. I am building the asp.net template project, there is no additional nuget packages or even additional code. When building the application locally to x64, it works fine.
Here are some relevant files:
Github Workflow file:
name: Build and Push Docker Image
on:
push:
branches:
- testing
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version from tag
id: vars
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "VERSION=latest" >> $GITHUB_ENV
fi
- name: Build and push Docker image
run: |
docker buildx build --no-cache --platform linux/arm64
--tag turwaith/pinfo-backend:latest
--push
--cache-from=type=registry,ref=turwaith/pinfo-backend:cache
--cache-to=type=inline
-f PinfoBackend/Dockerfile PinfoBackend/.
Dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 5000
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
# Copy the project file and restore dependencies
COPY PinfoBackend.csproj ./
RUN dotnet restore "PinfoBackend.csproj" --disable-parallel
# Copy all the source code and build the project
COPY . ./
RUN dotnet build "PinfoBackend.csproj" -c $BUILD_CONFIGURATION
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "PinfoBackend.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /m:1
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "PinfoBackend.dll"]
And the error that is shown in the github action log:
#14 [build 4/6] RUN dotnet restore "PinfoBackend.csproj" --disable-parallel
#14 10.59 Determining projects to restore...
#14 11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,5): error MSB4018: The "Message" task failed unexpectedly. [/src/PinfoBackend.csproj]
#14 11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object. [/src/PinfoBackend.csproj]
#14 11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,5): error MSB4018: at InvokeStub_Message.set_Text(Object, Span`1) [/src/PinfoBackend.csproj]
#14 11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,5): error MSB4018: at System.Reflection.MethodBaseInvoker.InvokePropertySetter(Object obj, BindingFlags invokeAttr, Binder binder, Object parameter, CultureInfo culture) [/src/PinfoBackend.csproj]
#14 11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,14): error MSB4026: The "Text=Restore entry point $(MSBuildProjectFullPath)" parameter for the "Message" task is invalid. [/src/PinfoBackend.csproj]
#14 11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,5): error MSB4063: The "Message" task could not be initialized with its input parameters. [/src/PinfoBackend.csproj]
#14 ERROR: process "/bin/sh -c dotnet restore "PinfoBackend.csproj" --disable-parallel" did not complete successfully: exit code: 1
------
> importing cache manifest from ***/pinfo-backend:cache:
------
------
> [build 4/6] RUN dotnet restore "PinfoBackend.csproj" --disable-parallel:
10.59 Determining projects to restore...
or MSB4018: at System.Reflection.MethodBaseInvoker.InvokePropertySetter(Object obj, BindingFlags invokeAttr, Binder binder, Object parameter, CultureInfo culture) [/src/PinfoBackend.csproj]
11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,14): error MSB4026: The "Text=Restore entry point $(MSBuildProjectFullPath)" parameter for the "Message" task is invalid. [/src/PinfoBackend.csproj]
11.54 /usr/share/dotnet/sdk/8.0.401/NuGet.targets(560,5): error MSB4063: The "Message" task could not be initialized with its input parameters. [/src/PinfoBackend.csproj]
------
Dockerfile:12
--------------------
10 | # Copy the project file and restore dependencies
11 | COPY PinfoBackend.csproj ./
12 | >>> RUN dotnet restore "PinfoBackend.csproj" --disable-parallel
13 |
14 | # Copy all the source code and build the project
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet restore "PinfoBackend.csproj" --disable-parallel" did not complete successfully: exit code: 1
Error: Process completed with exit code 1.
I have no idea what the message task is and I don’t really find anything about that.
2
After checking the issue, we can fix the issue by removing below settings in appsettings.json
.
,
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://0.0.0.0:5000"
}
}
}
Here is the correct sample code.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
I searched github repo by the project name and found yours, here is my github actions history.
And test in my side, it works properly.