Skip to content

Commit

Permalink
Support overriding of MSBuild SDKs path via environment variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
tintoy committed Apr 24, 2018
1 parent 7937c76 commit 87a371f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.2.36.{build}
version: 0.2.37.{build}
image: Visual Studio 2017
build_script:
- ps: >-
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## v0.2.37

* Support overriding of MSBuild SDKs path via environment variable (tintoy/msbuild-project-tools-server#5).

## v0.2.36

* Bug-fix: ArgumentException (parameter name: itemType) when requesting completions on root `Project` element (tintoy/msbuild-project-tools-server#5).
Expand Down
7 changes: 6 additions & 1 deletion src/LanguageServer.Common/Utilities/MSBuildHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,19 @@ public static Dictionary<string, string> CreateGlobalMSBuildProperties(DotNetRun
if (solutionDirectory.Length > 0 && solutionDirectory[solutionDirectory.Length - 1] != Path.DirectorySeparatorChar)
solutionDirectory += Path.DirectorySeparatorChar;

// Support overriding of SDKs path.
string sdksPath = Environment.GetEnvironmentVariable("MSBuildSDKsPath");
if (String.IsNullOrWhiteSpace(sdksPath))
sdksPath = Path.Combine(runtimeInfo.BaseDirectory, "Sdks");

return new Dictionary<string, string>
{
[WellKnownPropertyNames.DesignTimeBuild] = "true",
[WellKnownPropertyNames.BuildProjectReferences] = "false",
[WellKnownPropertyNames.ResolveReferenceDependencies] = "true",
[WellKnownPropertyNames.SolutionDir] = solutionDirectory,
[WellKnownPropertyNames.MSBuildExtensionsPath] = runtimeInfo.BaseDirectory,
[WellKnownPropertyNames.MSBuildSDKsPath] = Path.Combine(runtimeInfo.BaseDirectory, "Sdks"),
[WellKnownPropertyNames.MSBuildSDKsPath] = sdksPath,
[WellKnownPropertyNames.RoslynTargetsPath] = Path.Combine(runtimeInfo.BaseDirectory, "Roslyn")
};
}
Expand Down

0 comments on commit 87a371f

Please sign in to comment.