Dependency Groups: Duplicate Key Error

Topics: General
Jun 27, 2014 at 11:28 PM
Edited Jun 28, 2014 at 3:54 AM

I'm experiencing an issue similar to this one.

The problem for me is that I have 2 different groups as follows. Note that WhiteTie.TestFlavor.Dependency appears in both groups.
<group targetFramework="portable-net4+sl5+netcore45+MonoAndroid1+MonoTouch1">
    <dependency id="WhiteTie.TestFlavor.Dependency" version="" />
    <dependency id="Microsoft.Net.Http" version="2.2.22" />
    <dependency id="Microsoft.Bcl.Build" version="1.0.14" />
    <dependency id="Microsoft.Bcl" version="1.1.9" />
<group targetFramework="net451">
    <dependency id="WhiteTie.TestFlavor.Dependency" version="" />
Is this .nuspec wrong somehow? What is the recommended alternative if I must specify 2 distinct groups that share the same dependency?

Here's the pack command that I'm using:
pack "{MY PATH}\Test.csproj" -Properties Configuration=Release -NonInteractive -OutputDirectory "{MY PATH}\Test\bin\Release" -symbols
The error from the nuget pack command is:
"An item with the same key has already been added."

Breaking in WinDbg it seems that the cause of the error is in the ProjectFactory class's ProcessDependencies method. Specifically, the call to GetCompatiblePackageDependencies flattens all groups and applies ToDictionary with the Id of the dependency as the key, thus resulting in key collisions between like-named dependencies across multiple groups.

Any chance this will be fixed (unless I'm mistaken about how to properly use dependency groups)?