.net - 使用官方 Microsoft dotnet docker 镜像在 linux 上构建 dotnet

标签 .net linux visual-studio docker .net-core

我正在尝试在 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 项目基于 dotnet 框架 4.7,在我的本地我有 visual studio 等所以它在那里工作正常,但是如何在 linux 平台上使用基于 microsoft/dotnet 图像的容器让它工作?或者还有其他我可以用于 linux 的图像吗?

最佳答案

这是不可能的。 .NET Framework 与 Linux 不兼容。您的项目需要基于与 Linux 兼容的 .NET Core,才能使其正常工作。

关于.net - 使用官方 Microsoft dotnet docker 镜像在 linux 上构建 dotnet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54700822/

相关文章:

c# - 将int转换为int?可能的更新?

c# - 用户可定义的布局(在运行时)

c# - 通过 TCP 套接字发送命令的最佳方式是什么?

linux - 在没有root权限的情况下在windows和linux之间共享文件夹

python - 在树莓派上记录 python 错误

c++ - VSE(visual studio enterprise)2015 上的 C++ 中的 ShellExecute 不起作用

c# - 使用 xampp 的 C# 中的 MySql 错误 1064

c# - 如何在 C# 应用程序中使用 C++/CLI

.NET Framework 平台支持传统

c++ - 如何从 bash 更改库包含二进制文件的路径?