我试图在Mac OS X上的docker上运行该项目。该项目构建成功,但是目标进程退出了,而没有引发CoreCLR启动事件。

这是错误的列表

It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found.
  - Check application dependencies and target a framework version installed at:
      /
  - Alternatively, install the framework version '2.1.0'.
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 '[14] dotnet' has exited with code 131 (0x83).

我在每个项目中都添加了Microsoft.AspNetCore.App'2.1.0'。这是项目的屏幕截图。

c# - 在Visual Studio 7.5 Mac中找不到指定的框架 'Microsoft.AspNetCore.App'和版本 '2.1.0' docker-LMLPHP

Docker文件信息
FROM microsoft/aspnetcore AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore AS build
WORKDIR /src
COPY MeroRentalDev.sln ./
COPY Advetisement/Advetisement.csproj Advetisement/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/Advetisement
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

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

点网信息
c# - 在Visual Studio 7.5 Mac中找不到指定的框架 'Microsoft.AspNetCore.App'和版本 '2.1.0' docker-LMLPHP

将Docker镜像更新为最新版本
docker pull microsoft/dotnet

通过这些链接遵循了解决方案,但仍然无法解决问题。

The specified framework 'Microsoft.AspNetCore.App', version '2.1.0' was not found

How to fix 'Microsoft.NETCore.App', version '1.1.2' was not found?

最佳答案

发现解决方案需要更改docker文件

FROM microsoft/dotnet:2.1-sdk AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY MeroRentalDev.sln ./
COPY Auth.API/Auth.API.csproj Auth.API/
RUN dotnet restore -nowarn:msb3202,nu1503
COPY . .
WORKDIR /src/Auth.API
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

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

需要将microsoft / aspnetcore AS基础的更改为Microsoft / dotnet:2.1-sdk AS基础的

关于c# - 在Visual Studio 7.5 Mac中找不到指定的框架 'Microsoft.AspNetCore.App'和版本 '2.1.0' docker,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50762958/

10-16 09:43