ASP.NET Core 发布会在发布的文件夹中生成大量 DLL,为什么? [英] ASP.NET Core publish produces lots of DLLs in the published folder, why?

查看:27
本文介绍了ASP.NET Core 发布会在发布的文件夹中生成大量 DLL,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 .NET Core Framework 在 Visual Studio 2015 中创建了一个简单的 Web API 项目.当我使用默认设置发布此项目时,它会创建以下内容:

I created a simple Web API project in Visual Studio 2015 using the .NET Core Framework. When I publish this project using the default settings, it creates the following:

总共有 155 个 DLL,其中 77 个在 PublishOutput 根目录中,78 个在 refs 文件夹中.

In total there are 155 DLLs, 77 in the PublishOutput root and 78 in the refs folder.

  • 为什么将所有 DLL 都放在发布文件夹中?难道不能只是从单个共享引用安装它们的 DLL位置?

推荐答案

与之前版本的 .net 框架相比,Dotnet 核心往往非常小.

Dotnet core tend to be very minimal as opposed to the previous versions of .net framework.

在 dotnet core 中,主要目的是使核心框架尽可能小,如果您需要更多东西,请通过 NuGet 包引入.

因此,过去在框架中可用的许多依赖项现在都移到了 NuGet 包中,并且如您所知,NuGet 包中有一系列依赖项,因此我们最终将在发布输出中得到如此多的库,这很好.

So, many dependencies that used to be available in the framework are now moved to the NuGet packages and as you know there is a chain of dependencies in NuGet packages, so we will end up with so many libraries in our publish output, which is fine.

另一点是,在大多数情况下,我们使用的项目模板有太多可能不需要的依赖项.因此,我们可以从一个非常小的模板开始并在其中添加所需的内容,或者从更笨拙的模板中删除无用的内容.

Another point being, most of the time, we're using project templates with too many dependencies that might not be needed whatsoever. So we can either start with a very minimal template and add needed stuff in it, or remove useless stuff from a more chuncky template.

这篇关于ASP.NET Core 发布会在发布的文件夹中生成大量 DLL,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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