我有一个使用Microsoft.NET.Sdk.WindowsDesktop
项目 SDK 的 .NET Core 3.1 控制台应用程序,因为它Geometry3D
在System.Windows.Media.Media3D
.
我想在 Windows Nano Server 上的 Docker 容器中运行它,但在执行时收到以下错误docker run
:
It was not possible to find any compatible framework version
The framework 'Microsoft.WindowsDesktop.App', version '3.1.0' 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.WindowsDesktop.App&framework_version=3.1.0&arch=x64&rid=win10-x64
如何安装所需的 sdk 和运行时?
这是我现有的 Dockerfile:
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1903 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["HelloWpfCore/HelloWpfCore.csproj", "HelloWpfCore/"]
RUN dotnet restore "HelloWpfCore/HelloWpfCore.csproj"
COPY . .
WORKDIR "/src/HelloWpfCore"
RUN dotnet build "HelloWpfCore.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "HelloWpfCore.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HelloWpfCore.dll"]
GitHub 仓库在这里:https ://github.com/tonysneed/hello-netcore-wpf-nano