{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/cli/issues/1223","repository_url":"https://api.github.com/repos/dotnet/cli","labels_url":"https://api.github.com/repos/dotnet/cli/issues/1223/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/cli/issues/1223/comments","events_url":"https://api.github.com/repos/dotnet/cli/issues/1223/events","html_url":"https://github.com/dotnet/cli/issues/1223","id":131376793,"number":1223,"title":"How to use same dependency (version) in multiple project.json?","user":{"login":"enricosada","id":147243,"avatar_url":"https://avatars.githubusercontent.com/u/147243?v=3","gravatar_id":"","url":"https://api.github.com/users/enricosada","html_url":"https://github.com/enricosada","followers_url":"https://api.github.com/users/enricosada/followers","following_url":"https://api.github.com/users/enricosada/following{/other_user}","gists_url":"https://api.github.com/users/enricosada/gists{/gist_id}","starred_url":"https://api.github.com/users/enricosada/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enricosada/subscriptions","organizations_url":"https://api.github.com/users/enricosada/orgs","repos_url":"https://api.github.com/users/enricosada/repos","events_url":"https://api.github.com/users/enricosada/events{/privacy}","received_events_url":"https://api.github.com/users/enricosada/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-02-04T15:10:25Z","updated_at":"2016-02-04T23:22:56Z","closed_at":"2016-02-04T23:21:32Z","body":"A repository usually contains multiple projects and maybe multiple solutions. \r\nWith dotnet cli now there are multiple `project.json` (instead of multiple `csproj`)\r\n\r\nI list possible solutions i know if i want to use the same dependency (same version) in multiple project.json (if there are more, ok my bad):\r\n\r\n1. create a project.json for each project, and manually update references (and version) each time\r\n2. create a single project.json, if possible. It cannot always be possible, multiple nuget packages, helper app, etc.\r\n3. make `dotnet restore` pluggable, because standard behaviour cannot be not enough in different context. Or use another tool like dotnet restore.\r\n4. ?? \r\n\r\n### A real world example: this repository.\r\n\r\nUse of `-*` for dependencies has problems, so a specific version is pinned for the dependencies.\r\nNow each `project.json` should be updated when we need to bump a version of dependancies (like `NETStandard.Library` ).\r\nThat's not assure the same version of a shared package, because in two project with different dependancies, dotnet restore may use different version (each project.json is isolated by others).\r\n\r\nI think in the dotnet cli the solution applied is the `2`, to use a  single exe. That's how i understood the recent change from multiple .exe to a single exe, i can be wrong.\r\n\r\nI really prefer `3` (make `dotnet restore` pluggable), but that's another discussion so below it's my proposal:\r\n\r\n## use a shared depedencies list and aliases\r\n\r\nThe idea it's not mine, it's from multiple working solution in different ecosystem (bundler in ruby, etc)\r\n\r\nuse a shared global list of dependencies in the root of repo, like aliases, who can be grouped.\r\nEach project **can** use an alias in the dependencies property of project.json, and the generated .lock.json use the same version of the dependency in the shared global list.\r\n\r\nsomething like:\r\n\r\nglobal.json:\r\n\r\n```json\r\n\"dependencies\": {\r\n    \"$NETStandard_Library\": \"1.0.0-rc2-23728\",\r\n},\r\n```\r\n\r\nproject.json:\r\n\r\n```json\r\n\"dependencies\": {\r\n    \"NETStandard.Library\": \"$NETStandard_Library\",\r\n},\r\n```\r\n\r\nThe shared global list of dependencies are all resolved together or in groups, so it's fast (no need for multiple parallel project.json restore) and versions of grouped packages are compatible (so `library-a` use same version of `package1` as `library-b`, but `library-b` can use also others different dependancies).\r\n\r\nI wrote **can**, because it's an additional possibility the aliases, current behaviour can continue to exists (like in .csproj a path reference can coexists with nuget reference). \r\nI think it's a sane default to have all deps version in only one place, and `project.json` use only aliases.\r\nthe `project.json.lock` continue to exists, exatcly the current behaviour, no need to change all tools\r\n\r\nPls that's a problem who exists now, it can be ignored but is a common use case not covered by current dotnet cli and project.json project model.\r\nI think the problem was discussed before in dnx, but dotnet/cli it's not dnx, it use only assemblies on disk so it's easier\r\n\r\ni think i read something by @blackdwarf thinking about something else for this issue, but i can be wrong ( lots of notifications )\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/cli/issues/comments/180099359","html_url":"https://github.com/dotnet/cli/issues/1223#issuecomment-180099359","issue_url":"https://api.github.com/repos/dotnet/cli/issues/1223","id":180099359,"user":{"login":"csharpfritz","id":78577,"avatar_url":"https://avatars.githubusercontent.com/u/78577?v=3","gravatar_id":"","url":"https://api.github.com/users/csharpfritz","html_url":"https://github.com/csharpfritz","followers_url":"https://api.github.com/users/csharpfritz/followers","following_url":"https://api.github.com/users/csharpfritz/following{/other_user}","gists_url":"https://api.github.com/users/csharpfritz/gists{/gist_id}","starred_url":"https://api.github.com/users/csharpfritz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csharpfritz/subscriptions","organizations_url":"https://api.github.com/users/csharpfritz/orgs","repos_url":"https://api.github.com/users/csharpfritz/repos","events_url":"https://api.github.com/users/csharpfritz/events{/privacy}","received_events_url":"https://api.github.com/users/csharpfritz/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T23:22:56Z","updated_at":"2016-02-04T23:22:56Z","body":"Use the issue linked above that discusses this feature directly, no need to\nopen another issue\n\n\n\nJeff\n\n\n\nOn Thu, Feb 4, 2016 at 6:22 PM, Enrico Sada <notifications@github.com>\nwrote:\n\n> Closed #1223 <https://github.com/dotnet/cli/issues/1223>.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/dotnet/cli/issues/1223#event-539959182>.\n>\n"}}