diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 285f86277d28..72b80e639b97 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -330,4 +330,8 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 - \ No newline at end of file + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + + diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index b8b5ca2c895d..f43caa7ef10e 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 4e96f1583d49..8f46006ad3fc 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 0f1f3fd83c70..d13addab33b5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index de3467b05a08..062674afae40 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 90c15420faef..c404da688934 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 67fa0f3892b0..4e7405d1fdf9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index b91f23985a92..e6b0a62e870d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index ec77e1379c5d..ce01be9aeb8b 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 7a9b56597ceb..c0f435452673 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 9f6166b44a67..1d2aca5b68a2 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index ca49fcae294a..b8588c93da6d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 91fa422af207..81b12f0ccbeb 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index f5f5483dd584..7c794cb0ea26 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -357,6 +357,11 @@ You are working with a preview version of the .NET Core SDK. You can define the SDK version via a global.json file in the current project. More at https://go.microsoft.com/fwlink/?linkid=869452 + + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + \ No newline at end of file diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/JoinItems.cs b/src/Tasks/Microsoft.NET.Build.Tasks/JoinItems.cs index 30733cd99462..ea134c11dc67 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/JoinItems.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/JoinItems.cs @@ -21,6 +21,9 @@ public class JoinItems : TaskBase public string RightKey { get; set; } + // Set to "Left" or "Right" to use that itemspec in results. Leave blank to set itemspec based on the joined key value + public string ItemSpecToUse { get; set; } + // LeftMetadata and RightMetadata: The metadata names to include in the result. Specify "*" to include all metadata public string[] LeftMetadata { get; set; } @@ -36,6 +39,21 @@ public ITaskItem[] JoinResult protected override void ExecuteCore() { + bool useLeftItemSpec = false; + bool useRightItemSpec = false; + if (string.Equals(ItemSpecToUse, "Left", StringComparison.OrdinalIgnoreCase)) + { + useLeftItemSpec = true; + } + else if (string.Equals(ItemSpecToUse, "Right", StringComparison.OrdinalIgnoreCase)) + { + useRightItemSpec = true; + } + else if (!string.IsNullOrEmpty(ItemSpecToUse)) + { + throw new BuildErrorException(Strings.InvalidItemSpecToUse, ItemSpecToUse); + } + bool useAllLeftMetadata = LeftMetadata != null && LeftMetadata.Length == 1 && LeftMetadata[0] == "*"; bool useAllRightMetadata = RightMetadata != null && RightMetadata.Length == 1 && RightMetadata[0] == "*"; @@ -46,7 +64,7 @@ protected override void ExecuteCore() { // If including all metadata from left items and none from right items, just return left items directly if (useAllLeftMetadata && - string.IsNullOrEmpty(LeftKey) && + (string.IsNullOrEmpty(LeftKey) || useLeftItemSpec) && (RightMetadata == null || RightMetadata.Length == 0)) { return left; @@ -54,13 +72,27 @@ protected override void ExecuteCore() // If including all metadata from right items and none from left items, just return the right items directly if (useAllRightMetadata && - string.IsNullOrEmpty(RightKey) && + (string.IsNullOrEmpty(RightKey) || useRightItemSpec) && (LeftMetadata == null || LeftMetadata.Length == 0)) { return right; } - var ret = new TaskItem(GetKeyValue(LeftKey, left)); + string resultItemSpec; + if (useLeftItemSpec) + { + resultItemSpec = left.ItemSpec; + } + else if (useRightItemSpec) + { + resultItemSpec = right.ItemSpec; + } + else + { + resultItemSpec = GetKeyValue(LeftKey, left); + } + + var ret = new TaskItem(resultItemSpec); // Weird ordering here is to prefer left metadata in all cases, as CopyToMetadata doesn't overwrite any existing metadata if (useAllLeftMetadata) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePublishAssemblies.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePublishAssemblies.cs index e4a3d1a66b65..fd2d2e856153 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePublishAssemblies.cs +++ b/src/Tasks/Microsoft.NET.Build.Tasks/ResolvePublishAssemblies.cs @@ -85,6 +85,15 @@ protected override void ExecuteCore() item.SetMetadata("AssetType", resolvedAssembly.Asset.ToString().ToLower()); item.SetMetadata(MetadataKeys.PackageName, resolvedAssembly.Package.Id.ToString()); item.SetMetadata(MetadataKeys.PackageVersion, resolvedAssembly.Package.Version.ToString().ToLower()); + + if (resolvedAssembly.Asset == AssetType.Resources) + { + // For resources, the DestinationSubDirectory is set to the locale. Set the Culture + // metadata on the generated item to this value so that the satellite assemblies can + // be filtered by culture. + item.SetMetadata(MetadataKeys.Culture, resolvedAssembly.DestinationSubDirectory); + } + _assembliesToPublish.Add(item); } diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets index b79f3ccdd6ba..8080d80cafd1 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets @@ -259,6 +259,26 @@ Copyright (c) .NET Foundation. All rights reserved. + + + + + + + + + + + + + + + +