gpt4 book ai didi

c# - 为什么 .NET Core 应用程序总是很重?

转载 作者:行者123 更新时间:2023-12-04 14:13:51 25 4
gpt4 key购买 nike

关闭。这个问题是opinion-based .它目前不接受答案。












想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题.

去年关闭。




Improve this question




我想知道为什么 .NET Core 应用程序总是很重?

因为当我创建一个基本的 hello world 应用程序并发布它时。无论是在一个还是多个文件中。该程序至少有 20 MB,非常庞大。事实上,依赖项(.dll)非常多。例如,“hello world”仅请求调用系统库(使用 System;)。但是生成了许多库,因此应用程序是自治的。

实际上我正在尝试创建一个 tcp 服务器/客户端连接,但是客户端太重了(至少 20 个月...)

最佳答案

您可能正在以自包含模式构建此应用程序。这意味着整个 .NET Core 运行时都包含在您的构建输出中,这将为您的构建文件添加固定的数据大小。
如果不想包含 .NET Core 运行时,则必须将应用程序构建为依赖于运行时。请记住,您只能在已预安装 .NET Core 运行时的环境中运行此应用程序。

For reference :

Publishing your app as self-contained produces an application that includes the .NET Core runtime and libraries, and your application and its dependencies. Users of the application can run it on a machine that doesn't have the .NET Core runtime installed.

Publishing your app as runtime-dependent (previously known as framework-dependent) produces an application that includes only your application itself and its dependencies. Users of the application have to separately install the .NET Core runtime.

关于c# - 为什么 .NET Core 应用程序总是很重?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62260182/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com