关于.net核心应用程序的轻量级 [英] About light weight of .net core app

查看:42
本文介绍了关于.net核心应用程序的轻量级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是用.NET Core完成了一个小应用程序.

I just finish a small app, using .NET Core to see.

我正在发布时,在publish目录中有66个文件!

I'm at the publishing moment and in the publish directory there are 66 files!

我的应用程序本身是一个 47 Ko dll.好的,我使用efcore和newtonsoft json,但是我要部署的 14 Mo 各种dll(例如System.Security.Cryptography.OpenSsl.dll).

My app itself is a 47 Ko dll. All right, I use efcore and newtonsoft json, but I have 14 Mo of various dll (such as System.Security.Cryptography.OpenSsl.dll) to deploy.

同一个.NET(不是Core)应用程序要轻得多.

The same .NET (not Core) app would have been much more lighter.

我的问题是:我想念什么,因为根据.NET核心应用程序部署:

My question is: what do I miss, because according to .NET Core Application Deployment:

您的部署程序包很小.您只需要部署您的应用及其依赖项,而不是.NET Core本身.

The size of your deployment package is small. You only have to deploy your app and its dependencies, not .NET Core itself.

推荐答案

这是正确的,没有什么可担心的.与.NET Framework不同,.NET Core是模块化的,可以通过NuGet获取.因此,不需要安装任何繁琐的运行时.

That's correct and nothing to worry about. Unlike .NET Framework, .NET Core is modular and fetched via NuGet. So there is no fat runtime which needs to be installed.

.NET Core中有两种主要的应用程序类型:

There are two major type of applications in .NET Core:

便携式应用程序需要安装运行时.不在运行时中的所有内容都将作为软件包提供.

Portable applications require a runtime to be installed. Everything not part of the runtime will be shipped as packages.

或更具体地说: Microsoft.NETCore.App NETStandard.Library (这两个都是仅引用通用运行时的meta包库)或其依赖项之一,将通过nuget下载并与您的应用程序打包在一起.

Or to be more specific: Everything not included in Microsoft.NETCore.App or NETStandard.Library (both are meta packages which only reference common Runtime libraries) or one of it's dependencies, will be downloaded via nuget and packaged with your application.

自包含的应用程序允许您运行和部署.NET Core应用程序,而无需安装框架.在这种情况下,所有依赖项(包括运行时程序集)将与您的应用程序打包在一起.这允许使用不带.NET Core不同版本的多个应用程序并排运行,即不影响程序功能的更新.

Self-contained applications allow you to run and deploy .NET Core applications w/o installing the framework. In this case all dependencies (including runtime assemblies) will be packaged with your application. This allows multiple application to run side by side using different versions of .NET Core w/o i.e. an update affecting the programs functionality.

此外,您还具有依赖于本地库的本地依赖项(即Linux上的OpenSSL或Windows上的CryptoAPI),这些依赖项也将通过nuget交付并打包在您的部署中.

Additionally you also have native dependencies, which depend on native libraries (i.e. OpenSSL on Linux or CryptoAPI on Windows), which will be also shipped via nuget and packaged in your deployments.

这篇关于关于.net核心应用程序的轻量级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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