DEBUG;TRACE; Compile Problems

I have a simple project with a couple of relatively simple scripts. I am getting this error when I try to compile:

An item with the same key has already been added. (Error: System.ArgumentException) (Assembly-UnityScript)

Now, if I remove this line from both of the project Assembely-CSharp->Options->Compiler->Define Symbols and Assembely-UnityScript->Options-Compiler->Define Symbols:

DEBUG;TRACE;

It will compile, however, every single time I add a new script, it is back, and it’s becoming quite a nuisance.

I’ve tried deleting everything but the assets and config folder, and this problem persist. It doesn’t look like I am the only one either, as there are a couple of threads going on about this:

I am using 5.1 as well. Is there a solution for this?

I know this post is several months old, but it just started happening for me too after installing the Unity Test tools. My fix is similar but also temporary. I remove the duplicate DEBUG and TRACE terms inside of the Assembly-UnityScript.unitproj XML file. The duplicate terms are inside the element.

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        <DebugSymbols>true</DebugSymbols>
        <DebugType>full</DebugType>
        <Optimize>false</Optimize>
        <OutputPath>Temp\bin\Debug\</OutputPath>
        <DefineConstants>DEBUG;TRACE;UNITY_5_1_1;UNITY_5_1;UNITY_5;ENABLE_NEW_BUGREPORTER;ENABLE_2D_PHYSICS;ENABLE_4_6_FEATURES;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_FRAME_DEBUGGER;ENABLE_GENERICS;ENABLE_HOME_SCREEN;ENABLE_IMAGEEFFECTS;ENABLE_LIGHT_PROBES_LEGACY;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_PHYSICS_PHYSX3;ENABLE_PLUGIN_INSPECTOR;ENABLE_SHADOWS;ENABLE_SINGLE_INSTANCE_BUILD_SETTING;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_UNET;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_LICENSE;ENABLE_AUDIOMIXER_SUSPEND;ENABLE_EDITOR_METRICS;INCLUDE_DYNAMIC_GI;INCLUDE_GI;INCLUDE_IL2CPP;INCLUDE_DIRECTX12;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_LOCALIZATION;UNITY_ANDROID;UNITY_ANDROID_API;ENABLE_SUBSTANCE;ENABLE_TEXTUREID_MAP;ENABLE_EGL;ENABLE_NETWORK;ENABLE_RUNTIME_GI;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_MONO;DEVELOPMENT_BUILD;ENABLE_PROFILER;DEBUG;TRACE;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;
UNITY_EDITOR_OSX</DefineConstants>
...
</PropertyGroup>

After removing them, the compile error is resolved, but there are roughly 70+ warnings coming from the new package that only show up ONCE!

Then things are fine (no more warnings from the package) for the rest of the session.

I wish I had a better idea of the build process for C#, so that I might track this down. Alternatively, ONE of these packages (or ALL packages in general) should check the DEFINEs before they add to them.