An item with the same key has already been added while Installing nuget package -


in project, using class library . made class lib nuget package, remove class lib , when try install package error apears:"an item same key has been added"?

in case, saw error when packages.config file contained duplicate package ids isn't allowed.

you can use powershell script below find duplicate packages in solution. finds packages.config files recursively , per packages.config file, checks duplicate package ids.

$solutionfolder = "c:\mysolution" $nugetpackagefile = "packages.config"  $files = get-childitem -path $solutionfolder -filter $nugetpackagefile -recurse  foreach ($file in $files) {     [xml]$xml = get-content $file.fullname     $nodes = select-xml "/packages/package/@id" $xml     $packageids = @{}      foreach ($node in $nodes) {         $packageid = $node.node.'#text'         try         {             $packageids.add($packageid, $packageid)         }         catch [system.argumentexception]         {             write-host "found duplicate package in " $file.fullname ". duplicate package: $packageid"         }     } } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -