【发布时间】:2021-06-19 00:14:44
【问题描述】:
我正在尝试通过 docker image mcr.microsoft.com/dotnet/sdk:5.0 (https://hub.docker.com/_/microsoft-dotnet-sdk/) 发布一个 c# 项目。
在其中一个*.csproj 文件中有一个类似<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> 的定义
我收到以下错误
/usr/share/dotnet/sdk/5.0.301/Microsoft.Common.CurrentVersion.targets(1216,5): error MSB3644:
The reference assemblies for .NETFramework,Version=v4.6.1 were not found.
To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application.
You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
我尝试从 https://hub.docker.com/_/microsoft-dotnet-runtime-deps/ 安装一些依赖项,但这对我没有帮助。
我已经搜索了几个小时以找到在 linux 发行版中安装 Developer Packs 的教程,但一无所获。
有什么想法吗?
【问题讨论】:
-
您必须将项目转换为 .net (core) 5. .net 框架的东西不会自动在 linux 上运行。
-
@DanielA.White 感谢您的反馈。我已将 orject 转换为 .net (core) 5 并且可以正常工作。