Skip to content

Commit

Permalink
Merge pull request #1032 from kzu/master
Browse files Browse the repository at this point in the history
Select first VS2017 instance with the required Roslyn compilers component
  • Loading branch information
DustinCampbell authored Nov 27, 2017
2 parents 76810f8 + 40bd43e commit 5f6da1d
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.Setup.Configuration;
Expand Down Expand Up @@ -44,15 +45,16 @@ public override ImmutableArray<MSBuildInstance> GetInstances()
continue;
}

var instance = instances[0];
var state = ((ISetupInstance2)instance).GetState();
var instance = (ISetupInstance2)instances[0];
var state = instance.GetState();

if (!Version.TryParse(instance.GetInstallationVersion(), out var version))
{
continue;
}

if (state == InstanceState.Complete)
if (state == InstanceState.Complete &&
instance.GetPackages().Any(package => package.GetId() == "Microsoft.VisualStudio.Component.Roslyn.Compiler"))
{
// Note: The code below will likely fail if MSBuild's version increments.
var toolsPath = Path.Combine(instance.GetInstallationPath(), "MSBuild", "15.0", "Bin");
Expand Down

0 comments on commit 5f6da1d

Please sign in to comment.