From d135e27b26276e564099ba704ee02eb94025f7e7 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Tue, 27 Jul 2021 16:20:48 -0400 Subject: [PATCH 1/6] Alter RuntimeComponentManifest.targets to use the correct Runtime Pack When trying to process what runtime components are available, we were assuming %(ResolvedRuntimePack.PackageDirectory) would give us the correct Microsoft.NETCore.App runtime pack. Unfortunately, the ordering was likely altered when we started setting items in the Mono workload. Since relying on position of the items isn't reliable, we will instead use %(ResolvedFrameworkReference) to tell us which runtime pack is active and where it's located. Fixes https://github.com/dotnet/runtime/issues/56299 --- .../Sdk/RuntimeComponentManifest.targets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets index 411aeec01e563..232552cabdbed 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets @@ -3,7 +3,10 @@ - <_MonoRuntimeComponentManifestJsonFilePath Condition="'$(_MonoRuntimeComponentManifestJsonFilePath)' == ''">%(ResolvedRuntimePack.PackageDirectory)\runtimes\$(RuntimeIdentifier)\build\RuntimeComponentManifest.json + <_MonoRuntimeComponentManifestJsonFilePath + Condition="'$(_MonoRuntimeComponentManifestJsonFilePath)' == '' and '%(ResolvedFrameworkReference.Identity)' == 'Microsoft.NETCore.App'"> + %(RuntimePackPath)\runtimes\$(RuntimeIdentifier)\build\RuntimeComponentManifest.json + From 2193d6b1b9eeb4f131266ff47fa2960270bd8d62 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Wed, 28 Jul 2021 11:36:18 -0400 Subject: [PATCH 2/6] Feedback --- .../Sdk/RuntimeComponentManifest.targets | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets index 232552cabdbed..1ffd772613748 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets @@ -1,13 +1,16 @@ - + + <_MonoRuntimeComponentManifestJsonFilePath - Condition="'$(_MonoRuntimeComponentManifestJsonFilePath)' == '' and '%(ResolvedFrameworkReference.Identity)' == 'Microsoft.NETCore.App'"> - %(RuntimePackPath)\runtimes\$(RuntimeIdentifier)\build\RuntimeComponentManifest.json - + Condition="'$(_MonoRuntimeComponentManifestJsonFilePath)' == '' and '%(ResolvedFrameworkReference.Identity)' == 'Microsoft.NETCore.App'">$([MSBuild]::NormalizePath('%(RuntimePackPath)', 'runtimes', '$(RuntimeIdentifier)', 'build', 'RuntimeComponentManifest.json')) + + + From 29c27c36723b21b03988abeb5ccdcd8b4c825f66 Mon Sep 17 00:00:00 2001 From: Steve Pfister Date: Wed, 28 Jul 2021 12:32:32 -0400 Subject: [PATCH 3/6] Good feedback --- .../Sdk/RuntimeComponentManifest.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets index 1ffd772613748..d60b07e2a643a 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets @@ -9,7 +9,7 @@ + Text="Unable to read the runtime components manifest as the path: $(_MonoRuntimeComponentManifestJsonFilePath) does not exist" /> From 3a3d659befdc9c97be1938a2fc82a5099ac04b69 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 28 Jul 2021 15:22:01 -0400 Subject: [PATCH 4/6] JsonToItemsTaskFactory: error if json file not found --- src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.cs b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.cs index 2f7d1dc7ebfbe..b0d710e77f714 100644 --- a/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.cs +++ b/src/tasks/JsonToItemsTaskFactory/JsonToItemsTaskFactory.cs @@ -173,6 +173,12 @@ public bool Execute() Log.LogError($"no {nameof(JsonFilePath)} specified"); return false; } + if (!File.Exists(jsonFilePath)) + { + Log.LogError($"Could not find {nameof(JsonFilePath)}={jsonFilePath}"); + return false; + } + if (!TryGetJson(jsonFilePath, out var json)) return false; From e8b2b73cc2923d1b3cfff6956a4bbe059c7ae6a9 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 28 Jul 2021 15:22:22 -0400 Subject: [PATCH 5/6] Wasm.Build.Tests: Update ResolvedFrameworkReference, instead of adding a new one --- .../data/Blazor.Directory.Build.targets | 13 ++++++------- .../data/Workloads.Directory.Build.targets | 13 ++++++------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets index b0384d714e345..f77fc96c48d05 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Blazor.Directory.Build.targets @@ -36,13 +36,12 @@ PackageDirectory="$(NetCoreTargetingPackRoot)\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\$(RuntimePackInWorkloadVersion)" RuntimeIdentifier="browser-wasm" /> - + diff --git a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets index 62e463bb19958..105c0a74c0875 100644 --- a/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets +++ b/src/tests/BuildWasmApps/Wasm.Build.Tests/data/Workloads.Directory.Build.targets @@ -53,13 +53,12 @@ PackageDirectory="$(NetCoreTargetingPackRoot)\Microsoft.NETCore.App.Runtime.Mono.browser-wasm\$(RuntimePackInWorkloadVersion)" RuntimeIdentifier="browser-wasm" /> - + From 686a39fd2b542a00c38cb74fc2094c0ee1384624 Mon Sep 17 00:00:00 2001 From: Ankit Jain Date: Wed, 28 Jul 2021 15:39:38 -0400 Subject: [PATCH 6/6] RuntimeComponentManifest.target: emit more info when we fail to find the framework reference --- .../Sdk/RuntimeComponentManifest.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets index d60b07e2a643a..fcf1ff70d9a8f 100644 --- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets @@ -1,7 +1,7 @@ - + <_MonoRuntimeComponentManifestJsonFilePath