So after many hours banging my head I decided to write.
I started a very simple console project on VS2022
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>dfce778d-3821-42b2-af1a-b52233cd6dac</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>.</DockerfileContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="Quartz.AspNetCore" Version="3.4.0" />
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.4.0" />
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="4.2.0" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
</ItemGroup>
</Project>
I'm on Windows10 with a working Docker desktop running Linux containers
I've added linux container support on the project, pretty standard:
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Test.csproj", "."]
RUN dotnet restore "./Test.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "Test.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Test.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Test.dll"]
The solution builds and launches a new docker container but fails to start with the following error:
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '6.0.4' (x64) was not found.
- No frameworks were found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=6.0.4&arch=x64&rid=debian.11-x64
I've EXEC into the running container and installed some more .netcore related frameworks:
docker exec -it 3b083aa2ffc1066939c3083c5082d923a7a77aa72e816ebe3459f2d5af38aeab bash
root@3b083aa2ffc1:/app# dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.202
Commit: f8a55617d2
Runtime Environment:
OS Name: debian
OS Version: 11
OS Platform: Linux
RID: debian.11-x64
Base Path: /usr/share/dotnet/sdk/6.0.202/
Host (useful for support):
Version: 6.0.4
Commit: be98e88c76
.NET SDKs installed:
6.0.202 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
What is wrong with this thing? Someone can help out troubleshooting this error?