且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

.NET Core中的* deps.json文件

更新时间:2023-02-14 16:55:38

.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.