Skip to content

Commit 6bf3da2

Browse files
authored
Fix generated dll duplicate reference. (#2935)
1 parent f44a741 commit 6bf3da2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/BenchmarkDotNet/Toolchains/CsProj/CsProjGenerator.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,17 @@ public static int Main(string[] args)
161161

162162
if (!buildResult.IsBuildSuccess)
163163
{
164-
throw buildResult.TryToExplainFailureReason(out string reason)
165-
? new Exception(reason)
166-
: new Exception(buildResult.ErrorMessage);
164+
if (!buildResult.TryToExplainFailureReason(out string reason))
165+
{
166+
reason = buildResult.ErrorMessage;
167+
}
168+
logger.WriteLineWarning($"Failed to gather assembly references, reason:{Environment.NewLine}{reason}");
169+
return;
167170
}
168171

172+
// Delete the dll from the gatherer project to prevent duplicate references.
173+
File.Delete(Path.Combine(artifactsPaths.BinariesDirectoryPath, $"{artifactsPaths.ProgramName}.dll"));
174+
169175
xmlDoc = new XmlDocument();
170176
xmlDoc.Load(artifactsPaths.ProjectFilePath);
171177
projectElement = xmlDoc.DocumentElement;

0 commit comments

Comments
 (0)