Skip to content

Commit

Permalink
Create new ProjectCollection per test
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKotsenas committed Aug 29, 2024
1 parent e9e2112 commit 04ab71c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/DotNet.ReproducibleBuilds.Tests/ProjectTemplates.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Build.Utilities.ProjectCreation;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Utilities.ProjectCreation;

namespace DotNet.ReproducibleBuilds.Tests;

Expand All @@ -20,7 +21,9 @@ public static ProjectCreator ReproducibleBuildProject(this ProjectCreatorTemplat
.Import(Path.Combine(ThisAssemblyDirectory, "DotNet.ReproducibleBuilds.targets"))
.Save();

ProjectCollection projectCollection = new(); // Create a new collection for each project to ensure environment variables aren't shared between tests

return templates
.SdkCsproj(path: project.FullName, targetFramework: "net8.0");
.SdkCsproj(path: project.FullName, targetFramework: "net8.0", projectCollection: projectCollection);
}
}

0 comments on commit 04ab71c

Please sign in to comment.