question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An item with the same key has already been added. Key: TMP

See original GitHub issue

Steps to reproduce

mkdir hwapp
cd hwapp
dotnet new
dotnet restore
dotnet run

Expected behavior

I expecdted to see the “Hello World!” output.

Actual behavior

C:\Users\ohnob\OneDrive\Documents\Visual Studio 2015\Projects\hwapp>dotnet run
Project hwapp (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling hwapp for .NETCoreApp,Version=v1.0
An item with the same key has already been added. Key: TMP
C:\Program Files\dotnet\dotnet.exe compile-csc @C:\Users\ohnob\OneDrive\Documents\Visual Studio 2015\Projects\hwapp\obj\Debug\netcoreapp1.0\dotnet-compile.rsp returned Exit Code 1

Compilation failed.
    0 Warning(s)
    0 Error(s)

Time elapsed 00:00:00.1135244

Environment data

dotnet --info output:

C:\Users\ohnob\OneDrive\Documents\Visual Studio 2015\Projects\hwapp>dotnet --info
.NET Command Line Tools (1.0.0-preview2-003121)

Product Information:
 Version:            1.0.0-preview2-003121
 Commit SHA-1 hash:  1e9d529bc5

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
C:\Users\ohnob\OneDrive\Documents\Visual Studio 2015\Projects\hwapp>set | grep -ie TMP
TEMP=C:\msys64\tmp
TMP=C:\msys64\tmp
tmp=C:\Users\ohnob\AppData\Local\Temp

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:29 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
inosikcommented, Mar 29, 2017

@dsplaisted you need to add two environment variables which differ in case, like FOO and foo, then run dotnet restore, or any other command, which shells out to another program. This should trigger the exception:

$ FOO=foo foo=foo dotnet restore

The problem is the new implementation of ProcessStartInfo, which behaves differently to the one in the .NET Framework. This is actually already being tracked at dotnet/corefx#13146.

1reaction
ghostcommented, Aug 4, 2016

👍 always a good idea to namespace/prefix all your environment variables with app name, e.g. DOTNETCLI_TMP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

An item with the same key has already been added
Most likely, you have model which contains the same property twice. Perhaps you are using new to hide the base property.
Read more >
Error "An item with the same key has already been added"
This article helps to fix the error "An item with the same key has already been added". Applies to: Windows Server 2012 R2...
Read more >
An item with the same key has already been added.
1) in the Package Manager window, but I'm not sure if I'm actually using it as I downloaded TMP when it was available...
Read more >
An item with the same key has already been added Error
The error reads: "An item with the same key has already been added." It does not matter if I include the database name...
Read more >
SSRS Quick Tip – An item with the same key has already ...
I was in the process of creating a new report in SQL Server Reporting Services today. I was loading my dataset from a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found