Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to VS 2017 RC .NET Core SDK packages #738

Merged
merged 5 commits into from
Jan 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
154 changes: 88 additions & 66 deletions build.cake

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
***********************************************************************************************
Microsoft.NuGet.ImportAfter.targets

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Import NuGet.targets for Restore -->
<PropertyGroup>
<NuGetRestoreTargets Condition="'$(NuGetRestoreTargets)'==''">$(MSBuildExtensionsPath)\NuGet.targets</NuGetRestoreTargets>
</PropertyGroup>
<Import Condition="Exists('$(NuGetRestoreTargets)')" Project="$(NuGetRestoreTargets)" />
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
***********************************************************************************************
Microsoft.NuGet.ImportAfter.targets

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Import NuGet.targets for Restore -->
<PropertyGroup>
<NuGetRestoreTargets Condition="'$(NuGetRestoreTargets)'==''">$(MSBuildExtensionsPath)\NuGet.targets</NuGetRestoreTargets>
</PropertyGroup>
<Import Condition="Exists('$(NuGetRestoreTargets)')" Project="$(NuGetRestoreTargets)" />
</Project>
12 changes: 6 additions & 6 deletions packages/packages.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Build.Runtime" version="15.1.0-preview-000522-02" />
<package id="Microsoft.Build.Runtime" version="15.1.0-preview-000523-01" />
<package id="NuGet.Build.Tasks" version="4.0.0-rc3" />
<package id="NuGet.Build.Tasks.Pack" version="4.0.0-rc3" />
<package id="Microsoft.NET.Sdk" version="1.0.0-alpha-20170111-1" />
<package id="Microsoft.NET.Sdk.Web" version="1.0.0-alpha-20170106-1-203" />
<package id="Microsoft.NET.Sdk.Publish" version="1.0.0-alpha-20170106-1-203" />
<package id="Microsoft.NET.Sdk.Web.ProjectSystem" version="1.0.0-alpha-20170106-1-203" />
<package id="Microsoft.Net.Compilers" version="2.0.0-rc3-61318-04" />
<package id="Microsoft.NET.Sdk" version="1.0.0-alpha-20170123-1" />
<package id="Microsoft.NET.Sdk.Web" version="1.0.0-alpha-20170114-1-223" />
<package id="Microsoft.NET.Sdk.Publish" version="1.0.0-alpha-20170114-1-223" />
<package id="Microsoft.NET.Sdk.Web.ProjectSystem" version="1.0.0-alpha-20170114-1-223" />
<package id="Microsoft.Net.Compilers" version="2.0.0-rc3-61330-01" />
</packages>
4 changes: 4 additions & 0 deletions scripts/pathhelpers.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
string CombinePaths(params string[] paths)
{
return System.IO.Path.Combine(paths);
}
22 changes: 22 additions & 0 deletions src/OmniSharp.MSBuild/MSBuildEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public static class MSBuildEnvironment
{
private static bool s_isInitialized;
private static string s_msbuildFolder;
private static string s_msbuildExtensionsPath;
private static string s_msbuildSDKsPath;

public static bool IsInitialized => s_isInitialized;

Expand All @@ -20,6 +22,24 @@ public static string MSBuildFolder
}
}

public static string MSBuildExtensionsPath
{
get
{
EnsureInitialized();
return s_msbuildExtensionsPath;
}
}

public static string MSBuildSDKsPath
{
get
{
EnsureInitialized();
return s_msbuildSDKsPath;
}
}

public static void Initialize(ILogger logger)
{
if (s_isInitialized)
Expand Down Expand Up @@ -68,6 +88,7 @@ public static void Initialize(ILogger logger)
var msbuildSdksFolder = Path.Combine(msbuildFolder, "Sdks");
if (Directory.Exists(msbuildSdksFolder))
{
s_msbuildSDKsPath = msbuildSdksFolder;
Environment.SetEnvironmentVariable("MSBuildSDKsPath", msbuildSdksFolder);
logger.LogInformation($"MSBuildSDKsPath environment variable set to {msbuildSdksFolder}");
}
Expand All @@ -77,6 +98,7 @@ public static void Initialize(ILogger logger)
}

s_msbuildFolder = msbuildFolder;
s_msbuildExtensionsPath = msbuildFolder;
s_isInitialized = true;
}

Expand Down
2 changes: 2 additions & 0 deletions src/OmniSharp.MSBuild/Options/MSBuildOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ public class MSBuildOptions
public string ToolsVersion { get; set; }
public string VisualStudioVersion { get; set; }
public bool WaitForDebugger { get; set; }

public string MSBuildExtensionsPath { get; set; }
public string MSBuildSDKsPath { get; set; }

// TODO: Allow loose properties
// public IConfiguration Properties { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ private static class PropertyNames
public const string LangVersion = nameof(LangVersion);
public const string OutputType = nameof(OutputType);
public const string MSBuildExtensionsPath = nameof(MSBuildExtensionsPath);
public const string MSBuildSDKsPath = nameof(MSBuildSDKsPath);
public const string NoWarn = nameof(NoWarn);
public const string OutputPath = nameof(OutputPath);
public const string ProjectGuid = nameof(ProjectGuid);
Expand Down
13 changes: 11 additions & 2 deletions src/OmniSharp.MSBuild/ProjectFile/ProjectFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,18 @@ public void SetProjectId(ProjectId projectId)
{
globalProperties.Add(PropertyNames.MSBuildExtensionsPath, options.MSBuildExtensionsPath);
}
else
else if (!string.IsNullOrWhiteSpace(MSBuildEnvironment.MSBuildExtensionsPath))
{
globalProperties.Add(PropertyNames.MSBuildExtensionsPath, MSBuildEnvironment.MSBuildFolder);
globalProperties.Add(PropertyNames.MSBuildExtensionsPath, MSBuildEnvironment.MSBuildExtensionsPath);
}

if (!string.IsNullOrWhiteSpace(options.MSBuildSDKsPath))
{
globalProperties.Add(PropertyNames.MSBuildSDKsPath, options.MSBuildSDKsPath);
}
else if (!string.IsNullOrWhiteSpace(MSBuildEnvironment.MSBuildSDKsPath))
{
globalProperties.Add(PropertyNames.MSBuildSDKsPath, MSBuildEnvironment.MSBuildSDKsPath);
}

if (PlatformHelper.IsMono)
Expand Down