.net - 使用官方 microsoft dotnet docker 镜像在 linux 上构建 dotnet
问题描述
我正在尝试在 linux 主机上的官方 microsoft/dotnet 映像的容器中构建一个 dotnet 项目,因为该映像与 windows 和 linux 兼容。我只有 linux 主机,所以只能使用这个镜像作为容器来构建 dot net 项目。我发出如下命令:-
dotnet build ****.sln **arguments**
构建失败并出现如下错误:-
The imported project "/usr/share/dotnet/sdk/2.2.104/Microsoft/VisualStudio/v15.0/WebApplications/Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk."
dotnet 项目基于 dot net 框架 4.7,在我的本地我有 Visual Studio 等,所以它在那里工作正常,但是如何在 Linux 平台上使用基于 microsoft/dotnet 图像的容器使其工作?或者还有其他我可以用于 linux 的图像吗?
解决方案
这是不可能的。.NET Framework 与 Linux 不兼容。您的项目需要基于与 Linux 兼容的 .NET Core,才能使其正常工作。
推荐阅读
- angular - 角度 6 url 参数
- html - 使用 readlines 进行 HTML / XML 解析有缺点吗?
- flutter - PageView 与 TabBarView
- python - Python 和 Windows 10 最大路径长度
- c# - Autofac:如何解析类的所有通用接口
- java - 生成唯一的客户参考号
- ms-access - 如何检测控件是否是 MS Access vba 中的超链接
- delphi - 如何在东京构建 OSX 64 位应用程序
- javascript - 带有 froala 的外部 CSS
- python - Python C-API:如何在 Objective-C 中使用返回的 Python 字典?