且构网

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

.NET Core 中的 *deps.json 文件

更新时间:2023-02-14 16:56:08

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