Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Clean up rules around what is a valid dependency version in the project.json file #438

Closed
davidfowl opened this issue Jul 14, 2014 · 3 comments

Comments

@davidfowl
Copy link
Member

The current rules are too fuzzy and need to be more clearly defined. Today we have 3 kinds of references:

  • SDK references - These are reference assemblies or things in the GAC. Things like System.Data on the full CLR or System.Runtime when targeting a PCL target framework.
  • Project references - These are references to other projects (self explanatory really)
  • Package references - References to nuget packages

Today we allow "" for project dependencies since versions don't matter for projects. We also allow it for SDK references so you don't have to know what version System.Data actually is. This leads to ambiguity so we're going to stop allowing empty versions:

{
  "dependencies": {
    "ClassLibrary1": "1.0.0-*",
    "Newtonsoft.Json": "5.0.8"
  },  
  "frameworks": {
    "net45": { 
      "dependencies": {
        "System.Data": "4.0.0.0"       
      }
    }
  }
}

ClassLibrary1 - This is an example of a project reference. The version is ignored completely for source references. Whatever version of the source you have as project reference will be used.
System.Data - This is an SDK reference for .NET 4.5, if there's no version 4.0.0.0 on this platform this will be an error
Newtonsoft.Json - This is a package reference

@davidfowl davidfowl added this to the 1.0.0-alpha3 milestone Jul 14, 2014
@davidfowl davidfowl self-assigned this Jul 14, 2014
@glennc
Copy link
Member

glennc commented Sep 9, 2014

We should update the project templates to have a version number in the project.json when creating a new project.

Do it. Do it now!

@davidfowl
Copy link
Member Author

New set of rules:

Dependencies can have a specific type or by "any". Within the specific type certain fallback orders are allowed:

Project -> []
Package -> [Project]
Framework/GAC/SDK assembly -> []

Any means the dependency can come from Package or Project (Framework/GAC/SDK are specially declared in their own section).

We need a generic way of specifying the type of dependency (type is already taken to mean things like dev, build and shouldn't be confused with this).

{
    "dependencies": {
        "A": "1.0.0"
    }
}

A is of type any. If it's not a project then it will be considered a package and search for in the configured feeds when restoring.

{
    "dependencies": {
         "A" : { "target": "project" }
    }
}
{
    "dependencies": {
         "A" : { "version": "1.0.0-*", "target": "package" }
    }
}

@muratg
Copy link
Contributor

muratg commented Jul 13, 2015

Current decision from the design meeting:

{
   "dependencies": {
        "A": "1.0.0-*",
        "B" : { "version": "1.0.0-*", "target": "package" },
        "ClassLibrary12" : { "target": "project" },
        "ClassLibrary34" : { "target": "project" }
    }
}

@Eilon Eilon modified the milestones: 1.0.0-beta8, 1.0.0-beta7 Aug 11, 2015
analogrelay added a commit that referenced this issue Sep 23, 2015
Targets can be used to restrict a dependency so that it can only be
satisfied by a particular type of library.
analogrelay added a commit that referenced this issue Sep 25, 2015
Targets can be used to restrict a dependency so that it can only be
satisfied by a particular type of library.
analogrelay added a commit that referenced this issue Sep 25, 2015
Targets can be used to restrict a dependency so that it can only be
satisfied by a particular type of library.
analogrelay added a commit that referenced this issue Sep 25, 2015
Targets can be used to restrict a dependency so that it can only be
satisfied by a particular type of library.
analogrelay added a commit that referenced this issue Sep 25, 2015
Targets can be used to restrict a dependency so that it can only be
satisfied by a particular type of library.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants