使用官方的Microsoft Dotnet Docker映像进行Dotnet构建在Linux上



我正在尝试在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 Framework 4.7,在我的本地我有Visual Studio等,因此在那里工作正常,但是如何使用Microsoft/Dotnet Image基于Linux平台上的容器来使其正常工作?还是我可以为Linux使用其他图像?

这是不可能的。.NET框架与Linux不兼容。您的项目需要基于与Linux兼容的.NET Core,以使其工作。

最新更新