Skip to content

Commit b662b1b

Browse files
authored
Merge pull request #2533 from dsplaisted/implicit-aspnet-version
Add support in .NET SDK for implicit versions of AspNetCore.App and .All
2 parents dd6c5c8 + 101e3fd commit b662b1b

28 files changed

+546
-110
lines changed

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "2.2.100-preview1-009263"
3+
"version": "2.2.100-preview3-009413"
44
},
55
"msbuild-sdks": {
66
"RoslynTools.RepoToolset": "1.0.0-beta2-62912-01"

src/Tasks/Common/MessageBase.cs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ namespace Microsoft.NET.Build.Tasks
1212
/// </summary>
1313
public abstract class MessageBase : TaskBase
1414
{
15+
/// <summary>
16+
/// Formatted text for the message
17+
/// </summary>
18+
public string FormattedText { get; set; }
19+
1520
/// <summary>
1621
/// The name of the resource in Strings.resx that contains the desired error message.
1722
/// </summary>
18-
[Required]
1923
public string ResourceName { get; set; }
2024

2125
/// <summary>
@@ -31,17 +35,34 @@ internal MessageBase()
3135

3236
protected override void ExecuteCore()
3337
{
34-
if (FormatArguments == null || FormatArguments.Length == 0)
38+
string message = null;
39+
if (string.IsNullOrEmpty(FormattedText) && string.IsNullOrEmpty(ResourceName))
40+
{
41+
throw new ArgumentException($"Either {nameof(FormattedText)} or {nameof(ResourceName)} must be specified.");
42+
}
43+
else if (!string.IsNullOrEmpty(FormattedText) && !string.IsNullOrEmpty(ResourceName))
3544
{
36-
// We use a single-item array with one empty string in this case so that
37-
// it is possible to interpret FormatArguments="$(EmptyVariable)" as a request
38-
// to pass an empty string on to string.Format. Note if there are not placeholders
39-
// in the string, then the empty string arg will be ignored.
40-
FormatArguments = EmptyArguments;
45+
throw new ArgumentException($"Only one of {nameof(FormattedText)} and {nameof(ResourceName)} can be specified.");
4146
}
47+
else if (!string.IsNullOrEmpty(ResourceName))
48+
{
49+
if (FormatArguments == null || FormatArguments.Length == 0)
50+
{
51+
// We use a single-item array with one empty string in this case so that
52+
// it is possible to interpret FormatArguments="$(EmptyVariable)" as a request
53+
// to pass an empty string on to string.Format. Note if there are not placeholders
54+
// in the string, then the empty string arg will be ignored.
55+
FormatArguments = EmptyArguments;
56+
}
4257

43-
string format = Strings.ResourceManager.GetString(ResourceName, Strings.Culture);
44-
string message = string.Format(CultureInfo.CurrentCulture, format, FormatArguments);
58+
string format = Strings.ResourceManager.GetString(ResourceName, Strings.Culture);
59+
message = string.Format(CultureInfo.CurrentCulture, format, FormatArguments);
60+
}
61+
else
62+
{
63+
message = FormattedText;
64+
}
65+
4566

4667
LogMessage(message);
4768
}

src/Tasks/Common/MetadataKeys.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ internal static class MetadataKeys
1616
public const string PackageVersion = "PackageVersion";
1717
public const string IsImplicitlyDefined = "IsImplicitlyDefined";
1818
public const string IsTopLevelDependency = "IsTopLevelDependency";
19+
public const string AllowExplicitVersion = "AllowExplicitVersion";
1920

2021
// Target Metadata
2122
public const string RuntimeIdentifier = "RuntimeIdentifier";
@@ -81,8 +82,5 @@ internal static class MetadataKeys
8182
// Resource assemblies
8283
public const string Culture = "Culture";
8384
public const string DestinationSubDirectory = "DestinationSubDirectory";
84-
85-
// Expected platform packages
86-
public const string ExpectedVersion = "ExpectedVersion";
8785
}
8886
}

src/Tasks/Common/Resources/Strings.resx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,4 +401,7 @@ The following are names of parameters or literal values and should not be transl
401401
<value>NETSDK1070: The application configuration file must have root configuration element.</value>
402402
<comment>{StrBegin="NETSDK1070: "}</comment>
403403
</data>
404-
</root>
404+
<data name="PackageReferenceVersionNotRecommended" xml:space="preserve">
405+
<value>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</value>
406+
</data>
407+
</root>

src/Tasks/Common/Resources/xlf/Strings.cs.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: Chybí metadata {0} o {1} položky {2}.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: Nerozpoznaný token preprocesoru {0} v {1}.</target>

src/Tasks/Common/Resources/xlf/Strings.de.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: Die Metadaten "{0}" für das Element "{2}" vom Typ "{1}" sind nicht vorhanden.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: Unbekanntes Präprozessortoken "{0}" in "{1}".</target>

src/Tasks/Common/Resources/xlf/Strings.es.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: Faltan los metadatos de "{0}" en el elemento de "{1}" "{2}".</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: Token de preprocesador no reconocido "{0}" en "{1}".</target>

src/Tasks/Common/Resources/xlf/Strings.fr.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: Métadonnées '{0}' manquantes sur l'élément '{1}' '{2}'.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: Jeton de préprocesseur '{0}' non reconnu dans '{1}'.</target>

src/Tasks/Common/Resources/xlf/Strings.it.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: mancano i metadati di '{0}' sull'elemento '{2}' di '{1}'.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: token di preprocessore '{0}' non riconosciuto in '{1}'.</target>

src/Tasks/Common/Resources/xlf/Strings.ja.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: '{1}' 項目 '{2}' の '{0}' メタデータがありません。</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: 認識されないプリプロセッサ トークン '{0}' が '{1}' に存在します。</target>

src/Tasks/Common/Resources/xlf/Strings.ko.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: '{1}' 항목 '{2}'에 '{0}' 메타데이터가 없습니다.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: '{1}'에서 전처리기 토큰 '{0}'을(를) 인식할 수 없습니다.</target>

src/Tasks/Common/Resources/xlf/Strings.pl.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: Brak metadanych „{0}” w elemencie „{1}” „{2}”.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: Nierozpoznany token preprocesora „{0}” w elemencie „{1}”.</target>

src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: Metadados '{0}' ausentes no item '{1}' '{2}'.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: Token de pré-processador não reconhecido '{0}' em '{1}'.</target>

src/Tasks/Common/Resources/xlf/Strings.ru.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: отсутствуют метаданные "{0}" для элемента "{2}" в "{1}".</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: не распознан маркер препроцессора "{0}" в "{1}".</target>

src/Tasks/Common/Resources/xlf/Strings.tr.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: '{1}' öğesi '{2}' üzerinde '{0}' meta verileri eksik.</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: '{1}' içinde tanınmayan '{0}' ön işlemci belirteci.</target>

src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: 在“{1}”项“{2}”上缺少“{0}”元数据。</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009:“{1}”中无法识别预处理器标记“{0}”。</target>

src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
<target state="translated">NETSDK1008: '{1}' 項目 '{2}' 上遺漏 '{0}' 中繼資料。</target>
6868
<note>{StrBegin="NETSDK1008: "}</note>
6969
</trans-unit>
70+
<trans-unit id="PackageReferenceVersionNotRecommended">
71+
<source>NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</source>
72+
<target state="new">NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs</target>
73+
<note />
74+
</trans-unit>
7075
<trans-unit id="UnrecognizedPreprocessorToken">
7176
<source>NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'.</source>
7277
<target state="translated">NETSDK1009: '{1}' 中的前置處理器語彙基元 '{0}' 無法辨識。</target>

0 commit comments

Comments
 (0)