{"action":"created","issue":{"url":"https://api.github.com/repos/NuGet/Home/issues/2013","labels_url":"https://api.github.com/repos/NuGet/Home/issues/2013/labels{/name}","comments_url":"https://api.github.com/repos/NuGet/Home/issues/2013/comments","events_url":"https://api.github.com/repos/NuGet/Home/issues/2013/events","html_url":"https://github.com/NuGet/Home/issues/2013","id":129792505,"number":2013,"title":"nuget.exe update -Id not working when project has not restored packages ?","user":{"login":"christopheblin","id":11044877,"avatar_url":"https://avatars.githubusercontent.com/u/11044877?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheblin","html_url":"https://github.com/christopheblin","followers_url":"https://api.github.com/users/christopheblin/followers","following_url":"https://api.github.com/users/christopheblin/following{/other_user}","gists_url":"https://api.github.com/users/christopheblin/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheblin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheblin/subscriptions","organizations_url":"https://api.github.com/users/christopheblin/orgs","repos_url":"https://api.github.com/users/christopheblin/repos","events_url":"https://api.github.com/users/christopheblin/events{/privacy}","received_events_url":"https://api.github.com/users/christopheblin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-29T15:13:52Z","updated_at":"2016-01-30T00:01:46Z","closed_at":null,"body":"Try to do the following in a not compiled solution, replacing xxx with one of your packages :\r\n\r\n    nuget.Exe update -Id xxx \r\n\r\nYou will always have the result : \r\n\r\n    WARNING: can not find xxx. Make sure they are specified in packages.config.\r\n\r\nObviously, I use that command with a package that is specified in my packages.config.\r\n\r\nI look at the source code and find a strange thing in UpdateCommand.cs\r\n\r\n        private IEnumerable<IPackage> GetPackages(IPackageRepository repository)\r\n        {\r\n            var packages = repository.GetPackages();\r\n            if (Id.Any())\r\n            {\r\n                var packageIdSet = new HashSet<string>(packages.Select(r => r.Id), StringComparer.OrdinalIgnoreCase);\r\n                var idSet = new HashSet<string>(Id, StringComparer.OrdinalIgnoreCase);\r\n                var invalid = Id.Where(id => !packageIdSet.Contains(id));\r\n\r\n                if (invalid.Any())\r\n                {\r\n                    throw new CommandLineException(LocalizedResourceManager.GetString(\"UnableToFindPackages\"), String.Join(\", \", invalid));\r\n                }\r\n\r\n                packages = packages.Where(r => idSet.Contains(r.Id));\r\n            }\r\n            var packageSorter = new PackageSorter(targetFramework: null);\r\n            return packageSorter.GetPackagesByDependencyOrder(new ReadOnlyPackageRepository(packages)).Reverse();\r\n        }\r\n\r\nThe problem here is that the packages variable does not contain \"xxx\" (whereas my packages.config DOES contain it).\r\n\r\nIf I build the project and relaucnh the command it does not throw this error anymore.\r\n\r\nIs this a bug or a known limitation/quirck/.... ?"},"comment":{"url":"https://api.github.com/repos/NuGet/Home/issues/comments/177024994","html_url":"https://github.com/NuGet/Home/issues/2013#issuecomment-177024994","issue_url":"https://api.github.com/repos/NuGet/Home/issues/2013","id":177024994,"user":{"login":"yishaigalatzer","id":1238711,"avatar_url":"https://avatars.githubusercontent.com/u/1238711?v=3","gravatar_id":"","url":"https://api.github.com/users/yishaigalatzer","html_url":"https://github.com/yishaigalatzer","followers_url":"https://api.github.com/users/yishaigalatzer/followers","following_url":"https://api.github.com/users/yishaigalatzer/following{/other_user}","gists_url":"https://api.github.com/users/yishaigalatzer/gists{/gist_id}","starred_url":"https://api.github.com/users/yishaigalatzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yishaigalatzer/subscriptions","organizations_url":"https://api.github.com/users/yishaigalatzer/orgs","repos_url":"https://api.github.com/users/yishaigalatzer/repos","events_url":"https://api.github.com/users/yishaigalatzer/events{/privacy}","received_events_url":"https://api.github.com/users/yishaigalatzer/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T00:01:46Z","updated_at":"2016-01-30T00:01:46Z","body":"In general consider moving your projects to the project.json model where you have a much nicer model of updating packages (by just changing project.json file or using the * notation). The nuget.client repo is a good example for this pattern"}}