{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/cli/issues/602","labels_url":"https://api.github.com/repos/dotnet/cli/issues/602/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/cli/issues/602/comments","events_url":"https://api.github.com/repos/dotnet/cli/issues/602/events","html_url":"https://github.com/dotnet/cli/issues/602","id":122989143,"number":602,"title":"Dependency resolution changes context during packing with --no-source","user":{"login":"muratg","id":1808428,"avatar_url":"https://avatars.githubusercontent.com/u/1808428?v=3","gravatar_id":"","url":"https://api.github.com/users/muratg","html_url":"https://github.com/muratg","followers_url":"https://api.github.com/users/muratg/followers","following_url":"https://api.github.com/users/muratg/following{/other_user}","gists_url":"https://api.github.com/users/muratg/gists{/gist_id}","starred_url":"https://api.github.com/users/muratg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muratg/subscriptions","organizations_url":"https://api.github.com/users/muratg/orgs","repos_url":"https://api.github.com/users/muratg/repos","events_url":"https://api.github.com/users/muratg/events{/privacy}","received_events_url":"https://api.github.com/users/muratg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/cli/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/dotnet/cli/labels/Move%20to%20DotNet%20CLI","name":"Move to DotNet CLI","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-12-18T17:09:53Z","updated_at":"2015-12-18T17:09:56Z","closed_at":null,"body":"_From @Tragetaschen on December 2, 2014 10:20_\n\nI have the following setup:\r\n```\r\n./src/MyProject\r\n./external/Ninject (git submodule of Tragetaschen/Ninject forked from ninject/Ninject to drop a project.json)\r\n./external/DependencyInjection (git submodule of aspnet/DependencyInjection)\r\n./global.json (pointing to src, external/N/src, externel/DI/src)\r\n```\r\nThe reason is that the Nuget's Ninject does not work with Mono due to missing System.Reflection functionality and I have to compile it with the MONO flag. MyProject references Microsoft.Framework.DependencyInjection.Ninject and I'm trying get dependency resolution to pick up Ninject from the local folder.\r\n\r\nThe problem is that DependencyInjection comes with a global.json of its own and when `kpm pack --no-source` recurses into the M.F.D.Ninject, the BuildContext's _applicationHostContext reevaluates the RootDirectory and ends up with `./external/DI` instead of MyProject's RootDirectory `./`. With this RootDirectory, compilation of M.F.D.Ninject fails.This only happens with `--no-source`, copying the sources is fine.\r\n\r\nTo summarize:\r\n- `kpm restore` in MyProject successfully finds the local Ninject and does not download the nupkg\r\n- `kpm build` in MyProject finds (and reports) the local Ninject dependency\r\n- `kpm pack` copies the local Ninject dependency's source code\r\n- `kpm pack --no-source` first finds the local Ninject reference when compiling MyProject, but then fails to find it when compiling M.F.D.Ninject.\r\n\r\nI kind of feel like the last option should succeed like packing the source does.\n\n_Copied from original issue: aspnet/dnx#950_"},"comment":{"url":"https://api.github.com/repos/dotnet/cli/issues/comments/165842459","html_url":"https://github.com/dotnet/cli/issues/602#issuecomment-165842459","issue_url":"https://api.github.com/repos/dotnet/cli/issues/602","id":165842459,"user":{"login":"muratg","id":1808428,"avatar_url":"https://avatars.githubusercontent.com/u/1808428?v=3","gravatar_id":"","url":"https://api.github.com/users/muratg","html_url":"https://github.com/muratg","followers_url":"https://api.github.com/users/muratg/followers","following_url":"https://api.github.com/users/muratg/following{/other_user}","gists_url":"https://api.github.com/users/muratg/gists{/gist_id}","starred_url":"https://api.github.com/users/muratg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muratg/subscriptions","organizations_url":"https://api.github.com/users/muratg/orgs","repos_url":"https://api.github.com/users/muratg/repos","events_url":"https://api.github.com/users/muratg/events{/privacy}","received_events_url":"https://api.github.com/users/muratg/received_events","type":"User","site_admin":false},"created_at":"2015-12-18T17:09:56Z","updated_at":"2015-12-18T17:09:56Z","body":"_From @Tragetaschen on January 8, 2015 18:10_\n\nI don't see a problem that doesn't exist today. Or I missed something fundamentally :)\r\n\r\nIncluding a global.json is a shorthand for expanding its source-array. So the problem with lib1 also exists today when I use the following, primary global.json.\r\n```\r\n{\r\n    \"sources\": [\r\n        \"src\",\r\n        \"external/lib1.version2/src\",\r\n        \"external/lib2/src\", /* manually expanded */\r\n        \"external/lib2/external/lib1.version2\", /* manually expanded */\r\n        \"external/lib2/external/lib5\" /* manually expanded */\r\n    ]\r\n}\r\n```\r\nWith this, the answer is as far as I understand: `external/lib1.version2/src` is exposed, which is perfectly legitimate. If I move `external/lib1.version2/src` to the bottom lib2's version is exposed.\r\n\r\nWhen the submodule's global.json changes at a later date and includes new dependencies that existed before in my repository, it gets interesting. But updating any dependency blindly is bound to fail…"}}