【问题标题】:Use official microsoft dotnet docker image for dotnet builds on linux使用官方的 microsoft dotnet docker 镜像在 linux 上构建 dotnet
【发布时间】:2019-07-09 02:16:40
【问题描述】:

我正在尝试在 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 的图像吗?

【问题讨论】:

  • 据我所知,Linux 支持 .NET Core,但不支持 .NET Framework。 microsoft/dotnet 用于 .NET Core,也许你的项目是 .NET Framework。
  • 是的,所以无论如何我们都可以让它在 linux 上运行?在linux平台上构建点网项目必须有一些图像或某种方式吗?

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


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-03-10
    • 1970-01-01
    • 2020-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-21
    • 1970-01-01
    • 2019-04-24
    相关资源
    最近更新 更多