Closed rklec closed 3 months ago
As a sanity check, I validated that a basic scenario involving dotnet pack
works using a Dockerfile:
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS sdk
ARG APP_NAME="MyLibrary"
# Boilerplate to create a sample project that we can pack
FROM sdk AS template
RUN dotnet new classlib --name $APP_NAME -f netstandard2.0 --no-restore -o /src
# Copy project files and restore
FROM sdk AS restore
WORKDIR /src/
COPY --from=template /src/*.csproj .
RUN dotnet restore
# Copy sources and build + pack
FROM restore AS build
COPY --from=template /src/. .
RUN dotnet build -c Release $APP_NAME.csproj
RUN dotnet pack --no-build -o /packages
This may be an issue with your project configuration, Azure DevOps, or MSBuild/the .NET SDK. I don't think it's an issue with the .NET container images, given that the basic scenario above works.
To isolate the issue, you could try to build your packages directly in the Docker container on your local machine (interactively or with a Dockerfile like above). You could also try and run the dotnet
CLI directly using script
tasks in your pipeline, instead of using the Azure DevOps tasks - I'm not sure what those are doing on the backend that could be messing with the .NET installation.
Ah yeah sorry it was the build placed it into the wrong outputDirectory
, sorry.
Describe the Bug
dotnet pack
fails inside of the conmtainer with wild errors like:Note that the restore and build itself, before, in separate steps, work without problems, however. The project itself is really very simple, here e.g. the whole
.csproj
of the....Utils.API
project:There arer other projects in the repo to be build/packaged, but AFAIK already this one fails.
Steps to Reproduce
My Azure DevOps pipeline fails at the state for "dotnet pack", where it should pack the .NET 8.0 project written in C#. Pipeline uses the Docker container
mcr.microsoft.com/dotnet/sdk:8.0
.Relevant pipeline snippet:
Here is the output error/log of
dotnet pack
: https://gist.github.com/rklec/7171e9fb3a764b4219e06732adc7decaOther Information
Container used:
Also, the build itself does work:
Output of
docker version
Only have this in the log:
Output of
docker info
Container runs on Ubuntu Linux