{"action":"closed","issue":{"url":"https://api.github.com/repos/fsprojects/Paket/issues/750","labels_url":"https://api.github.com/repos/fsprojects/Paket/issues/750/labels{/name}","comments_url":"https://api.github.com/repos/fsprojects/Paket/issues/750/comments","events_url":"https://api.github.com/repos/fsprojects/Paket/issues/750/events","html_url":"https://github.com/fsprojects/Paket/issues/750","id":66848586,"number":750,"title":"An item with the same key has already been added: Project with a project dependency that shares the same assembly name prefix","user":{"login":"Ian2020","id":7791246,"avatar_url":"https://avatars.githubusercontent.com/u/7791246?v=3","gravatar_id":"","url":"https://api.github.com/users/Ian2020","html_url":"https://github.com/Ian2020","followers_url":"https://api.github.com/users/Ian2020/followers","following_url":"https://api.github.com/users/Ian2020/following{/other_user}","gists_url":"https://api.github.com/users/Ian2020/gists{/gist_id}","starred_url":"https://api.github.com/users/Ian2020/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ian2020/subscriptions","organizations_url":"https://api.github.com/users/Ian2020/orgs","repos_url":"https://api.github.com/users/Ian2020/repos","events_url":"https://api.github.com/users/Ian2020/events{/privacy}","received_events_url":"https://api.github.com/users/Ian2020/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-07T10:27:43Z","updated_at":"2015-04-07T14:33:27Z","closed_at":"2015-04-07T14:33:27Z","body":"We receive the following error when packing certain solutions:\r\n```\r\nPaket failed with:\r\n        An item with the same key has already been added.\r\n```\r\nThis can be reproduced minimally by packing the following solution:\r\n\r\n* Project FooBar\r\n    * Builds FooBar.dll\r\n    * Has basic paket.template file (type is project, id is FooBar, description is \"blah\")\r\n    * Has project dependency on FooBar.Utils (below)\r\n* Project FooBar.Utils\r\n    * Builds FooBar.Utils.dll\r\n    * No paket.template file\r\n\r\nWe have debugged the latest code and believe this is because of a bug in the way output files are gathered for a project in PackageMetaData.fs, around line 155:\r\n```\r\nfi.Directory.GetFiles(fi.Name.Replace(fi.Extension,\"\") + \".*\")\r\n```\r\nThis will incorrectly pick up FooBar.Utils.dll as an output of project FooBar as it matches the wildcard expression 'FooBar.*'. We then add FooBar.Utils.dll again later to the files for this package as it is a project dependency.\r\n\r\nThe error we see is thrown when we try to create the zip package file and add the second FooBar.Utils.dll to the archive at the same path as the previous one. The error is thrown from line 206 of NupkgWriter.fs:\r\n```\r\nzipFile.AddFile(source, targetFileName.Replace(\" \", \"%20\")) |> ignore\r\n```\r\nWe would suggest that this problem will occur whenever a project with a paket.template file references another project and they share an assembly name prefix (FooBar. in this case).\r\n\r\nThe full error and stacktrace is below:\r\n```\r\nPaket failed with:\r\n        An item with the same key has already been added.\r\nStackTrace:\r\n     at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](Result`1 res)\r\n   at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token, FSharpAsync`1 computation, FSharpOption`1 timeout)\r\n   at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation, FSharpOption`1 timeout, FSharpOption`1 cancellationToken)\r\n   at Paket.PackageProcess.Pack(DependenciesFile dependencies, String packageOutputPath, FSharpOption`1 buildConfig, FSharpOption`1 version, FSharpOption`1 releaseNotes)\r\n   at Paket.Program.clo@198-21.Invoke(ArgParseResults`1 results)\r\n   at Paket.Program.processWithValidation[T](FSharpFunc`2 validateF, FSharpFunc`2 commandF, Command command, String[] args)\r\n   at Paket.Program.processCommand@59-1.Invoke(Command command, String[] args)\r\n   at <StartupCode$paket>.$Paket.Program.main@()\r\n```"}}