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.
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.
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.
DEPS files specify which files the sources in a directory tree may include.
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.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With