如何创建 dotnet 核心单个可执行文件 [英] How to create a dotnet core single executable

查看:41
本文介绍了如何创建 dotnet 核心单个可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的 dotnet 核心项目配置为编译为单个可执行文件.

I would like to configure my dotnet core project to compile as a single executable.

该项目类似于用dotnet new生成的项目:

The project is similar to the one generated with dotnet new:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.1": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.1.0"
        }
      },
      "imports": "dnxcore50"
    }
  },
  "runtimes": {
     "win10-x64": {}
   }
}

我怎样才能使它编译为单个 program.exe?当我运行 dotnet publish 时,它会将 dll 和 program.exe 放在发布文件夹中,但不会合并它们.

How can I make it so this compiles as a single program.exe? When I run dotnet publish it puts dlls and the program.exe in a publish folder, but doesn't combine them.

推荐答案

最接近的答案可能是 CoreRT(.Net Core 到 Native).它将非常适合但存在小问题 - 该项目仍处于早期阶段.一年前,他们向我们展示了演示,但这是一个非常简单的示例,对于更高级的项目将不起作用.更多信息如何尝试这样做.

The closest to answer is probably CoreRT (.Net Core to Native). It will be excellent fit but exist small problem - This project is still in early apha. A year ago they showed us demo but it was a very simple example and for more advanced projects will not work. Some more information how to try do this.

这篇关于如何创建 dotnet 核心单个可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆