The target process exited without raising CoreCLR started event error with .NET 6

當Visual Studio安裝不完全, 可能會導致別人電腦看以Run, 我的電腦竟然不能

It was not possible to find any compatible framework version

The framework 'Microsoft.AspNetCore.App', version '6.0.0' (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.0&arch=x64&rid=debian.11-x64

解法其實有很多方式, 第一種方式就是調整 DockerFile

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

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 ["xxxxxxxx.csproj", "xxxxxxxx/"]
RUN dotnet restore "xxxxxxxx.csproj"
COPY . .
WORKDIR "/src/xxxxxxxx"
RUN dotnet build "xxxxxxxx.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "xxxxxxxx.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "xxxxxxxx.dll"]

修正為如下

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["xxxxxxxx.csproj", "xxxxxxxx/"]
RUN dotnet restore "xxxxxxxx.csproj"
COPY . .
WORKDIR "/src/xxxxxxxx"
RUN dotnet build "xxxxxxxx.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "xxxxxxxx.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "xxxxxxxx.dll"]

第二種解法為Visual Studio Installer安裝組建 .NET Core Runtime (EOL)也是可以解決

訂閱
通知
guest
0 留言
預約回饋
查看所有留言