I am not familiar with Windows containers, and I am getting this error when trying to debug a hello-world DotNet 6 application in VS2022:
Cannot use file stream for [C:\app\bin\Debug\net6.0\WebApplication5.runtimeconfig.json]: Permission denied
Invalid runtimeconfig.json [C:\app\bin\Debug\net6.0\WebApplication5.runtimeconfig.json] [C:\app\bin\Debug\net6.0\WebApplication5.runtimeconfig.dev.json]
The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
The program '[13360] dotnet.exe' has exited with code 2147516563 (0x80008093).
Dockerfile (default):
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompat
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WebApplication5/WebApplication5.csproj", "WebApplication5/"]
RUN dotnet restore "WebApplication5/WebApplication5.csproj"
COPY . .
WORKDIR "/src/WebApplication5"
RUN dotnet build "WebApplication5.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebApplication5.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication5.dll"]
I tried to spin the container in an interactive way, to validate if the file was actually there but this command did not work:
docker run -it --entrypoint powershell.exe webapplication5
docker: Error response from daemon: container 8581fd662043dbfad4a2b68e561d21c106e4754b6f21c4d06cfb9b3d5e2b0a39 encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2).
What can the problem be? Why I cannot get a PS inside the container?