【问题标题】:Cross compile dotnet core app from Windows to Linux从 Windows 交叉编译 dotnet 核心应用程序到 Linux
【发布时间】:2016-08-02 10:48:43
【问题描述】:

我在 Windows 中工作,想在 Windows 上构建一个 dotnet 核心应用程序,以便在 Linux 上运行。在 build 文件夹中,我在已发布文件夹中看到 .DLL 文件引用,这显然不适用于 Linux - 如何从我的 Windows 环境编译应用程序以在 Linux 上运行?有可能吗?

在 project.json 文件中指定了运行时版本,我认为这与 C:\Program Files\dotnet\sdk\1.0.0-preview2-003121\runtimes 位置中的运行时相关?如果是这样,我如何在 Windows 中安装 Linux 运行时并引用它?

【问题讨论】:

标签: linux windows cross-compiling asp.net-core-1.0 kestrel-http-server


【解决方案1】:

您可以使用发布命令创建自包含应用程序。

例如(.Net Core 2.0):

dotnet publish -c release -r win7-x64
dotnet publish -c release -r centos.7-x64

您还需要在RuntimeIdentifiers 中指定win7-x64 OR centos.7-x64 以及.csproj 文件。

For more help check this page.

【讨论】:

    猜你喜欢
    • 2021-12-30
    • 1970-01-01
    • 2010-09-15
    • 1970-01-01
    • 1970-01-01
    • 2023-01-27
    • 1970-01-01
    • 2017-06-22
    相关资源
    最近更新 更多