diff --git a/Assets/Scripts/Editor/Compilation/DotnetExeCompilator.cs b/Assets/Scripts/Editor/Compilation/DotnetExeCompilator.cs index 35ebdb8..96d1b81 100644 --- a/Assets/Scripts/Editor/Compilation/DotnetExeCompilator.cs +++ b/Assets/Scripts/Editor/Compilation/DotnetExeCompilator.cs @@ -218,16 +218,22 @@ private static string GenerateCompilerArgsRspFileContents(string outLibraryPath, rspContents.AppendLine($"-define:{symbol}"); } + Dictionary nameLoaded = new Dictionary(); foreach (var referenceToAdd in ResolveReferencesToAdd(new List())) { - if (originalAssemblyPathToAsmWithInternalsVisibleToCompiled.TryGetValue(referenceToAdd, out var asmWithInternalsVisibleTo)) + string key = Path.GetFileName(referenceToAdd); + if (!nameLoaded.ContainsKey(key)) // Avoid duplicates of the same assembly { - //Changed assembly have InternalsVisibleTo added to it to avoid any issues where types are defined internal - rspContents.AppendLine($"-r:\"{asmWithInternalsVisibleTo}\""); - } - else - { - rspContents.AppendLine($"-r:\"{referenceToAdd}\""); + if (originalAssemblyPathToAsmWithInternalsVisibleToCompiled.TryGetValue(referenceToAdd, out var asmWithInternalsVisibleTo)) + { + //Changed assembly have InternalsVisibleTo added to it to avoid any issues where types are defined internal + rspContents.AppendLine($"-r:\"{asmWithInternalsVisibleTo}\""); + } + else + { + rspContents.AppendLine($"-r:\"{referenceToAdd}\""); + } + nameLoaded.Add(key, true); } } @@ -344,4 +350,4 @@ public HotReloadCompilationException(string message, Exception innerException, s SourceCodeCombinedFileCreated = sourceCodeCombinedFileCreated; } } -} \ No newline at end of file +}