Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between 'dependencies' and 'frameworkAssemblies' in project.json?

The documentation for using project.json for ASP.NET 5 applications includes a sample project.json file (abbreviated version below).

What is the difference between frameworkAssemblies and dependencies?

And why does dnx451 use one and dnxcore50 use the other?

{
  "version": "0.1-alpha-*",
  ...
  "frameworks": {
    "dnx451": {
     "frameworkAssemblies": {
        ...
      }
    },
    "dnxcore50": {
     "dependencies": {
       ...
     }
  }
}

like image 304
natemcmaster Avatar asked Jun 10 '15 05:06

natemcmaster


People also ask

What is dependency in framework?

Dependency injection in . NET is a built-in part of the framework, along with configuration, logging, and the options pattern. A dependency is an object that another object depends on. Examine the following MessageWriter class with a Write method that other classes depend on: C# Copy.

How is project assets json generated?

json file is generated in the process of restoring the NuGet packages in projects that use project. json . It holds a snapshot of all the information that is generated as NuGet walks the graph of packages and includes the version, contents, and dependencies of all the packages in your project.

What is a project JSON file?

Project. json is an automatically generated file which is included in the folder of each automation project made in Studio. The file holds information about the project dependencies, and web services loaded in libraries.

Which JSON file helps you installs the right versions of the packages you need and their dependencies?

Bower is a package manager for the web. Bower can manage components that contain HTML, CSS, JavaScript, fonts or even image files. Bower doesn't concatenate or minify code or do anything else – it just installs the right versions of the packages you need and their dependencies.


1 Answers

frameworkAssemblies refers to assemblies present in GAC (global assembly cache).

Consider the following example:
I want to use ADO.NET apis(SqlConnection, SqlCommand) to work with a SQL Server database. I know that these apis are part of System.Data.dll and so want to reference it. Now when the full version of .NET Framework is installed, it installs some assemblies in the GAC (which has this System.Data.dll too) and hence you see a reference to frameworkassemblies in the below example. Coming to CoreClr, I need to find out in which package these types exist. For this you could use the website called PackageSearch(built by an ASP.NET team member) where you can search for a type and find the package name. Based on this you will find System.Data.SqlClient to be the package. Since this package is built for CoreClr, it is part of dependencies section within the dnxcore50 section.

{
    "version": "1.0.0-*",
    "description": "Test App",
    "dependencies": {
    },
    "frameworks": {
        "dnx451": {
            "frameworkAssemblies": {
                "System.Data": "4.0.0.0"
            }
        },
        "dnxcore50": {
            "dependencies": {
                "System.Data.SqlClient": "4.0.0-beta-*"
            }
        }
    }
}

Now let's say you want to even add support for json serialization and deserialization in your app and want to reference Json.Net nuget package. Json.Net nuget package supports both the desktop and core clr and hence you would put it in the dependencies section common to both frameworks.

{
    "version": "1.0.0-*",
    "description": "Test App",
    "dependencies": {
        "Newtonsoft.Json": "6.0.6"
    },
    "frameworks": {
        "dnx451": {
            "frameworkAssemblies": {
                "System.Data": "4.0.0.0"
            }
        },
        "dnxcore50": {
            "dependencies": {
                "System.Data.SqlClient": "4.0.0-beta-*"
            }
        }
    }
}
like image 158
Kiran Avatar answered Oct 11 '22 13:10

Kiran