Skip to content

Commit

Permalink
Merge pull request #735 from DustinCampbell/fix-msbuild-env-on-proces…
Browse files Browse the repository at this point in the history
…s-attach

Use Application.BaseDirectory when searching for OmniSharp.sln in MSBuildEnvironment
  • Loading branch information
filipw committed Jan 27, 2017
2 parents d42e4e9 + e253b86 commit 3e7e9c0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/OmniSharp.MSBuild/MSBuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void Initialize(ILogger logger)
// If the 'msbuild' folder does not exist beneath OmniSharp.exe, this is likely a development scenario,
// such as debugging or running unit tests. In that case, we use one of the .msbuild-* folders at the
// solution level.
msbuildFolder = FindMSBuildFolderFromSolution();
msbuildFolder = FindMSBuildFolderFromSolution(logger);
}

if (msbuildFolder == null)
Expand Down Expand Up @@ -88,12 +88,14 @@ private static void EnsureInitialized()
}
}

private static string FindMSBuildFolderFromSolution()
private static string FindMSBuildFolderFromSolution(ILogger logger)
{
// Try to locate the appropriate build-time msbuild folder by searching for
// the OmniSharp solution relative to the current folder.

var current = Directory.GetCurrentDirectory();
logger.LogInformation("Searching for solution OmniSharp.sln to locate MSBuild tools...");

var current = AppContext.BaseDirectory;
while (!File.Exists(Path.Combine(current, "OmniSharp.sln")))
{
current = Path.GetDirectoryName(current);
Expand Down

0 comments on commit 3e7e9c0

Please sign in to comment.