asp.net 8 dockerfile Add folder not working when VS 2022 set to release mode
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
The following dockerfile works fine when visual studio is set to debug mode:
```
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["sscp/sscp.csproj", "sscp/"]
RUN dotnet restore "./sscp/./sscp.csproj"
COPY . .
WORKDIR "/src/sscp"
RUN dotnet build "./sscp.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./sscp.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
ADD lib /app/lib
ADD Temp /app/Temp
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "sscp.dll"]
```
However when I set visual studio to release mode with no modifications to dockerfile I get the following error:
**Error DT1001 failed to solve: failed to compute cache key: failed to calculate checksum of ref e0a7708d-82bc-42a9-a987-dfcf6e79a5e1::ecmpb7j21c9p21hz7c89ek5ot: "/lib": not found**
Any help would be greatly appreciated.
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
8.0.100
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.