Skip to content

Commit

Permalink
use built-in registration check
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Sep 20, 2024
1 parent b837087 commit aa9d767
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class NuGetMSBuildBinaryLogComponentDetector : FileComponentDetector
};

private static readonly object MSBuildRegistrationGate = new();
private static bool isMSBuildRegistered;

public NuGetMSBuildBinaryLogComponentDetector(
IObservableDirectoryWalkerFactory walkerFactory,
Expand Down Expand Up @@ -166,12 +165,11 @@ internal static void EnsureMSBuildIsRegistered()
{
lock (MSBuildRegistrationGate)
{
if (!isMSBuildRegistered)
if (!MSBuildLocator.IsRegistered)
{
// this must happen once per process, and never again
var defaultInstance = MSBuildLocator.QueryVisualStudioInstances().First();
MSBuildLocator.RegisterInstance(defaultInstance);
isMSBuildRegistered = true;
}
}
}
Expand Down

0 comments on commit aa9d767

Please sign in to comment.