.NET Core中的* deps.json文件 [英] The *deps.json file in .NET Core

查看:1284
本文介绍了.NET Core中的* deps.json文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET Core中* deps.json文件的用途是什么?
是将引用存储在此类文件中而不是存储在程序集清单中的原因(如在独立的.NET Framework中)?

What is the purpose of *deps.json file in .NET Core? What is the reason to store references in such file and not in assembly manifest(as in standalone .NET Framework)?

使用Ildasm我检查了该程序集清单在dotnet构建命令之后不包含这些依赖项的条目。

Using Ildasm i checked that assembly manifest doesn't contain entries for these dependecies after dotnet build command.

但是在dotnet发布命令之后具有条目。

But it has entries after dotnet publish command.

推荐答案

.deps.json 文件包含有关已生成程序集引用的程序集的元数据以及搜索它们的位置作为有关所使用的编译选项的信息。

The .deps.json file contains metadata about the assemblies referenced by the built assembly and the locations to search for them as well as information about the compilation options used.

此信息由加载并加载的本机组件( corehost )读取。配置运行时。当需要加载引用的程序集时,主机将使用此文件中的信息(以及任何 runtimeconfig.json / runtimeconfig.dev。 json )以找到要加载的正确程序集。

This information is read by the native component (corehost) that loads and configures the runtime. When a referenced assembly needs to be loaded, the host will use the information in this file (as well as any runtimeconfig.json/runtimeconfig.dev.json) to locate the correct assembly to load.

此信息也在其他地方使用。例如,ASP.NET Core的Razor视图编译也使用它来将正确的引用和配置传递给生成的代码。当将单元测试库加载到测试主机中时,单元测试主机还需要使用此文件中的信息。 Microsoft.Extensions.DependencyModel NuGet包中提供了读取和写入此文件的托管API。

This information is used in other places as well. For example ASP.NET Core's Razor view compilation also uses it to pass the correct references and configuration to the generated code. And unit test hosts also need to use the information in this file when a unit test library is loaded into the test host. The managed API to read and write this file is available in the Microsoft.Extensions.DependencyModel NuGet package.

这篇关于.NET Core中的* deps.json文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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