installing nuget package "same key has already been added."

Your stack-trace tells the tale, it is NuGet.NetPortableProfileTable.BuildPortableProfileCollection() that fails. In a nutshell, it iterates the set of PCL reference assembly profiles and encounters the same profile more than once. This is a very strong hint that the content of your c:\program files (x86)\reference assemblies\microsoft\framework\.netportable directory is corrupted.

There are many possible ways to go about fixing the damage:

  • If you have an active recollection of tinkering with this directory, like copying files, then undo what you did.
  • Safest way to go about it is to uninstall all Visual Studio versions >= VS2010. Then clean up the directory by hand, deleting any stray files that are still present. Then reinstalling VS again.
  • The not-so-safe but speedier way is to rename the c:\program files (x86)\reference assemblies directory and install the multi-targeting pack. I can't promise success.
  • You can try to find the duplicate yourself and remove it. The directory structure looks like this:

 Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile

05/14/2014  01:01 PM    <DIR>          Profile1
05/14/2014  01:01 PM    <DIR>          Profile102
05/14/2014  01:01 PM    <DIR>          Profile104
05/14/2014  01:01 PM    <DIR>          Profile131
05/14/2014  01:01 PM    <DIR>          Profile136
05/14/2014  01:01 PM    <DIR>          Profile14
05/14/2014  01:01 PM    <DIR>          Profile143
05/14/2014  01:01 PM    <DIR>          Profile147
05/14/2014  01:01 PM    <DIR>          Profile154
05/14/2014  01:01 PM    <DIR>          Profile158
05/14/2014  01:01 PM    <DIR>          Profile18
05/14/2014  01:01 PM    <DIR>          Profile19
05/14/2014  01:01 PM    <DIR>          Profile2
05/14/2014  01:01 PM    <DIR>          Profile225
05/14/2014  01:01 PM    <DIR>          Profile23
05/14/2014  01:01 PM    <DIR>          Profile24
05/14/2014  01:01 PM    <DIR>          Profile240
05/14/2014  01:01 PM    <DIR>          Profile255
05/14/2014  01:01 PM    <DIR>          Profile3
05/14/2014  01:01 PM    <DIR>          Profile328
05/14/2014  01:01 PM    <DIR>          Profile336
05/14/2014  01:01 PM    <DIR>          Profile344
05/14/2014  01:01 PM    <DIR>          Profile36
05/14/2014  01:01 PM    <DIR>          Profile37
05/14/2014  01:01 PM    <DIR>          Profile4
05/14/2014  01:01 PM    <DIR>          Profile41
05/14/2014  01:01 PM    <DIR>          Profile42
05/14/2014  01:01 PM    <DIR>          Profile46
05/14/2014  01:01 PM    <DIR>          Profile47
05/14/2014  01:01 PM    <DIR>          Profile5
05/14/2014  01:01 PM    <DIR>          Profile6
05/14/2014  01:01 PM    <DIR>          Profile88
05/14/2014  01:01 PM    <DIR>          Profile92
05/14/2014  01:01 PM    <DIR>          Profile95
05/14/2014  01:01 PM    <DIR>          Profile96

 Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.5\Profile

05/14/2014  12:59 PM    <DIR>          .
05/14/2014  12:59 PM    <DIR>          ..
05/14/2014  01:01 PM    <DIR>          Profile111
05/14/2014  01:01 PM    <DIR>          Profile259
05/14/2014  01:01 PM    <DIR>          Profile49
05/14/2014  01:01 PM    <DIR>          Profile7
05/14/2014  01:01 PM    <DIR>          Profile78

 Directory of C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.6\Profile

05/14/2014  12:59 PM    <DIR>          .
05/14/2014  12:59 PM    <DIR>          ..
05/14/2014  01:01 PM    <DIR>          Profile151
05/14/2014  01:01 PM    <DIR>          Profile157
05/14/2014  01:01 PM    <DIR>          Profile31
05/14/2014  01:01 PM    <DIR>          Profile32
05/14/2014  01:01 PM    <DIR>          Profile44
05/14/2014  01:01 PM    <DIR>          Profile84

Check your packages.config Inside there, check for the packages you are trying to install. Maybe some reference are already there and this avoid that you can install the new ones.

If you find there the references, delete the reference from the packages.config and try to install again the package.

It happened to me sometimes that inside packages.config are some old reference that still left there even after removing the package from the Nuget Package Manager.

If not, you can delete the entire packages.config, then if you have the option to let Nuget download the packages, when you build your solution, the packages will be downloaded again.

I hope this helps