Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The *deps.json file in .NET Core

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.

like image 783
Roman Roman Avatar asked Oct 07 '17 15:10

Roman Roman


People also ask

What is DEPS json file in .NET Core?

deps. json file, which lists the dependencies of the application or library. A . runtimeconfig. json file, which specifies the shared runtime and its version for an application.

What is the use of DEPS json file?

deps. json) to locate these assemblies. This file is generated during the build process and will use the same relative path as the NuGet package for the location of these assemblies. Since the file is not found in the same folder, the application will fail to start.

What is a DEPS file?

DEPS files specify which files the sources in a directory tree may include.

What is Launchsetting JSON in ASP.NET Core?

The launchSettings. json file is used to store the configuration information, which describes how to start the ASP.NET Core application, using Visual Studio. The file is used only during the development of the application using Visual Studio. It contains only those settings that required to run the application.

What is Deps JSON file?

deps.json The deps.jsonfile is a dependencies manifest. It can be used to configure dynamic linking to assemblies that come from packages. As mentioned above, .NET Core can be configured to dynamically load assemblies from multiple locations.

How many configuration JSON files are there in ASP NET Core?

Different configuration json files in ASP.net Core There are mainly 6 configuration JSON files in ASP.net Core. projects − projects property defines the location of source code for your solution. It specifies two location for projects in the solution: src and test.src contains actual application and test contains any test.

What is appsettings JSON in ASP NET Core?

ASP.NET Core uses AppSettings.json to store custom application setting, DB connection strings,Logging etc.. Below is a sample of Appsettings.json − You can define the configuration for bundling and minification for the project. [ { "outputFileName": "wwwroot/css/site.min.css", // An array of relative input file paths.

What happens if a JSON file isn't present in a directory?

When the *.deps.json file isn't present, the application's directory is assumed to contain all the dependencies. The directory's contents are used to populate the probing properties. Additionally, the *.deps.json files for any referenced frameworks are similarly parsed.


1 Answers

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.

like image 117
Martin Ullrich Avatar answered Sep 19 '22 13:09

Martin Ullrich