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

查看:39
本文介绍了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 ,在PublishOutput根目录中有77个,在refs文件夹中有78个.

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

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

推荐答案

与以前的.net框架版本相比,Dotnet内核的规模往往非常小.

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

在dotnet核心中,主要目的是使核心框架尽可能小,如果需要更多内容,请通过NuGet软件包将其引入.

In dotnet core, the main purpose was making the core framework as small as possible and if you need more stuff, bring it in through NuGet packages.

因此,许多以前在框架中可用的依赖项现在都移到了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天全站免登陆