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

Include requested .NET SDK version when known #25733

Merged
merged 1 commit into from
Jun 3, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,16 @@ public override SdkResult Resolve(SdkReference sdkReference, SdkResolverContext
{
warnings = new List<string>();
}
warnings.Add(Strings.GlobalJsonResolutionFailed);

if (!string.IsNullOrWhiteSpace(resolverResult.RequestedVersion))
{
warnings.Add(string.Format(Strings.GlobalJsonResolutionFailedSpecificVersion, resolverResult.RequestedVersion));
}
else
{
warnings.Add(Strings.GlobalJsonResolutionFailed);
}

if (propertiesToAdd == null)
{
propertiesToAdd = new Dictionary<string, string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@
<data name="GlobalJsonResolutionFailed" xml:space="preserve">
<value>Unable to locate the .NET SDK as specified by global.json, please check that the specified version is installed.</value>
</data>
<data name="GlobalJsonResolutionFailedSpecificVersion" xml:space="preserve">
<value>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</value>
baronfel marked this conversation as resolved.
Show resolved Hide resolved
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Nepovedlo se najít sadu .NET SDK uvedenou v souboru global.json. Zkontrolujte prosím, že je nainstalovaná zadaná verze.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} nejde najít. Zajistěte, aby byla nainstalovaná dostatečně vysoká verze sady .NET SDK, nebo zvyšte verzi zadanou v souboru global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Das in "global.json" angegebene .NET SDK wurde nicht gefunden. Überprüfen Sie, ob die angegebene Version installiert ist.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} wurde nicht gefunden. Stellen Sie sicher, dass eine aktuelle Version des .NET SDK installiert ist, und/oder erhöhen Sie die in "global.json" angegebene Version.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">No se encuentra el SDK de .NET tal y como se especifica en global.json; compruebe que la versión especificada esté instalada.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">No se encuentra {0}. Compruebe que hay un SDK de .NET suficientemente reciente instalado o aumente la versión especificada en global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Impossible de localiser le kit .NET SDK spécifié par global.json. Vérifiez que la version indiquée est installée.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} introuvable. Vérifiez qu'un SDK .NET suffisamment récent est installé et/ou augmentez la version spécifiée dans global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Non è possibile trovare la versione di .NET SDK specificata in global.json. Verificare che sia installata la versione specificata.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} non è stato trovato. Verificare che sia installata una versione abbastanza recente di .NET SDK e/o aumentare la versione specificata in global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">global.json で指定されている .NET SDK が見つかりません。指定されたバージョンがインストールされていることをご確認ください。</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} が見つかりません。十分新しい .NET SDK がインストールされていることを確認するか、global.json で指定するバージョンを上げてください (どちらも実行する必要がある場合もあります)。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">global.json에 지정된 대로 .NET SDK를 찾을 수 없습니다. 지정한 버전이 설치되어 있는지 확인하세요.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0}을(를) 찾을 수 없습니다. 최신 .NET SDK가 설치되어 있는지 확인하거나 global.json에 지정된 버전을 높이세요.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Nie można zlokalizować zestawu .NET SDK, który został określony przez plik global.json. Upewnij się, że określona wersja jest zainstalowana.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">Nie można odnaleźć elementu {0}. Sprawdź, czy zainstalowano wystarczająco aktualną wersję zestawu .NET SDK i/lub zwiększ wersję określoną w pliku global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Não é possível localizar o .NET SDK como especificado pelo global.json. Verifique se a versão especificada está instalada.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} não encontrado. Verifique se um SDK do .NET suficientemente recente está instalado e/ou aumente a versão especificada em global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">Не удалось найти пакет SDK для .NET, указанный в файле global.json. Убедитесь, что указанная версия установлена.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} не найден. Убедитесь, что установлена достаточно свежая версия пакета SDK для .NET, и (или) увеличьте версию, указанную в файле global.json.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">global.json tarafından belirtilen .NET SDK bulunamıyor, lütfen belirtilen sürümün yüklü olduğundan emin olun.</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">{0} bulunamadı. Yeterince yeni bir .NET SDK'nın yüklü olduğundan emin olun ve/veya global.json içinde belirtilen sürümü artırın.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">无法找到 global.json 指定的 .NET SDK,请检查是否安装了指定的版本。</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">找不到 {0}。请检查是否安装了足够新的 .NET SDK 并/或调高在 global.json 中指定的版本。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<target state="translated">找不到 global.js 所指定的 .NET SDK,請檢查是否已安裝指定的版本。</target>
<note />
</trans-unit>
<trans-unit id="GlobalJsonResolutionFailedSpecificVersion">
<source>Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</source>
<target state="new">Unable to locate the .NET SDK version '{0}' as specified by global.json, please check that the specified version is installed.</target>
<note />
</trans-unit>
<trans-unit id="MSBuildSDKDirectoryNotFound">
<source>{0} not found. Check that a recent enough .NET SDK is installed and/or increase the version specified in global.json.</source>
<target state="translated">找不到 {0}。請檢查安裝的 .NET SDK 是否夠新,以及 (或) 在 global.json 中指定較新的版本。</target>
Expand Down
1 change: 1 addition & 0 deletions src/Resolvers/Microsoft.DotNet.NativeWrapper/Interop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ internal enum hostfxr_resolve_sdk2_result_key_t : int
{
resolved_sdk_dir = 0,
global_json_path = 1,
requested_version = 2,
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public class SdkResolutionResult
/// </summary>
public string GlobalJsonPath;

/// <summary>
/// The .NET SDK version specified in <strong>global.json</strong>.
/// </summary>
public string RequestedVersion;

/// <summary>
/// True if a global.json was found but there was no compatible SDK, so it was ignored.
/// </summary>
Expand All @@ -32,6 +37,9 @@ internal void Initialize(Interop.hostfxr_resolve_sdk2_result_key_t key, string v
case Interop.hostfxr_resolve_sdk2_result_key_t.global_json_path:
GlobalJsonPath = value;
break;
case Interop.hostfxr_resolve_sdk2_result_key_t.requested_version:
RequestedVersion = value;
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public void ItReturnsHighestSdkAvailableThatIsCompatibleWithMSBuildWhenVersionIn
result.PropertiesToAdd.ContainsKey("SdkResolverGlobalJsonPath");
result.PropertiesToAdd["SdkResolverHonoredGlobalJson"].Should().Be("false");
result.Version.Should().Be(disallowPreviews ? "98.98.98" : "99.99.99-preview");
result.Warnings.Should().BeEquivalentTo(new[] { "Unable to locate the .NET SDK as specified by global.json, please check that the specified version is installed." });
result.Warnings.Should().BeEquivalentTo(new[] { "Unable to locate the .NET SDK version '1.2.3' as specified by global.json, please check that the specified version is installed." });
result.Errors.Should().BeNullOrEmpty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ public void It_fails_build_on_failed_sdk_resolution(bool runningInVS)
var result = buildCommand.Execute($"/p:BuildingInsideVisualStudio={runningInVS}", $"/bl:binlog{runningInVS}.binlog")
.Should()
.Fail();
var warningString = "warning : Unable to locate the .NET SDK as specified by global.json, please check that the specified version is installed.";
var warningString = runningInVS
? "warning : Unable to locate the .NET SDK version '9.9.999' as specified by global.json, please check that the specified version is installed."
: "warning : Unable to locate the .NET SDK as specified by global.json, please check that the specified version is installed.";
var errorString = "Unable to locate the .NET SDK. Check that it is installed, your PATH is configured for the correct architecture, and that the version specified in global.json (if any) matches the installed version.";
if (runningInVS)
{
Expand Down