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)?
Using Ildasm i checked that assembly manifest doesn't contain entries for these dependecies after dotnet build command.
But it has entries after dotnet publish command.
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.
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.
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.