From 9efaad971f5ce0f2f426ddde381feb75c2fad067 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Sun, 30 Dec 2018 00:14:44 -0800 Subject: [PATCH] Include runtime pack and other additional information for known frameworks --- src/core-sdk-tasks/GetRuntimePackRids.cs | 30 ++++++++++ src/core-sdk-tasks/core-sdk-tasks.csproj | 3 +- src/redist/redist.csproj | 1 + src/redist/targets/BuildCoreSdkTasks.targets | 1 + src/redist/targets/DownloadPackage.csproj | 1 + .../targets/GenerateBundledVersions.targets | 57 +++++++++++++++++++ 6 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 src/core-sdk-tasks/GetRuntimePackRids.cs diff --git a/src/core-sdk-tasks/GetRuntimePackRids.cs b/src/core-sdk-tasks/GetRuntimePackRids.cs new file mode 100644 index 000000000..fa7b9b483 --- /dev/null +++ b/src/core-sdk-tasks/GetRuntimePackRids.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; +using Newtonsoft.Json.Linq; + +namespace Microsoft.DotNet.Cli.Build +{ + public class GetRuntimePackRids : Task + { + [Required] + public string MetapackagePath { get; set; } + + [Output] + public ITaskItem[] AvailableRuntimePackRuntimeIdentifiers { get; set; } + + public override bool Execute() + { + string runtimeJsonPath = Path.Combine(MetapackagePath, "runtime.json"); + string runtimeJsonContents = File.ReadAllText(runtimeJsonPath); + var runtimeJsonRoot = JObject.Parse(runtimeJsonContents); + string [] runtimeIdentifiers = ((JObject)runtimeJsonRoot["runtimes"]).Properties().Select(p => p.Name).ToArray(); + AvailableRuntimePackRuntimeIdentifiers = runtimeIdentifiers.Select(rid => new TaskItem(rid)).ToArray(); + return true; + } + } +} diff --git a/src/core-sdk-tasks/core-sdk-tasks.csproj b/src/core-sdk-tasks/core-sdk-tasks.csproj index 0230cd854..f1d04cfd4 100644 --- a/src/core-sdk-tasks/core-sdk-tasks.csproj +++ b/src/core-sdk-tasks/core-sdk-tasks.csproj @@ -3,6 +3,7 @@ $(CoreSdkTargetFramework);net472 $(CoreSdkTargetFramework) true + Microsoft.DotNet.Cli.Build @@ -12,7 +13,7 @@ - + diff --git a/src/redist/redist.csproj b/src/redist/redist.csproj index bb921b7a7..285ed6e1b 100644 --- a/src/redist/redist.csproj +++ b/src/redist/redist.csproj @@ -6,6 +6,7 @@ + diff --git a/src/redist/targets/BuildCoreSdkTasks.targets b/src/redist/targets/BuildCoreSdkTasks.targets index 8eb0e1784..ce846644b 100644 --- a/src/redist/targets/BuildCoreSdkTasks.targets +++ b/src/redist/targets/BuildCoreSdkTasks.targets @@ -36,5 +36,6 @@ + diff --git a/src/redist/targets/DownloadPackage.csproj b/src/redist/targets/DownloadPackage.csproj index a316ea118..b63f33898 100644 --- a/src/redist/targets/DownloadPackage.csproj +++ b/src/redist/targets/DownloadPackage.csproj @@ -3,6 +3,7 @@ Library false + true diff --git a/src/redist/targets/GenerateBundledVersions.targets b/src/redist/targets/GenerateBundledVersions.targets index 4ae8a05b5..2994e501e 100644 --- a/src/redist/targets/GenerateBundledVersions.targets +++ b/src/redist/targets/GenerateBundledVersions.targets @@ -44,6 +44,47 @@ <_NETCoreSdkIsPreview Condition=" '$(DropSuffix)' != 'true' ">true + + + + + PackageToRestore=Microsoft.NETCore.App; + PackageVersionToRestore=$(MicrosoftNETCoreAppPackageVersion); + TargetFramework=$(TargetFramework) + + + + + PackageToRestore=Microsoft.WindowsDesktop.App; + PackageVersionToRestore=$(MicrosoftWindowsDesktopPackageVersion); + TargetFramework=$(TargetFramework) + + + + + PackageToRestore=Microsoft.AspNetCore.App; + PackageVersionToRestore=$(MicrosoftAspNetCoreAppPackageVersion); + TargetFramework=$(TargetFramework) + + + + + + + + + + + + + + + + +