Add warning for PreferNativeArm64 (#40895)

Co-authored-by: Rainer Sigwald <raines@microsoft.com>
This commit is contained in:
YuliiaKovalova 2024-05-29 18:40:55 +02:00 коммит произвёл GitHub
Родитель 30ecc66ee3
Коммит 2581c90406
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
17 изменённых файлов: 125 добавлений и 0 удалений

Просмотреть файл

@ -948,5 +948,9 @@ You may need to build the project on another operating system or architecture, o
<value>NETSDK1213: Targeting .NET 8.0 or higher in Visual Studio 2022 17.7 is not supported.</value>
<comment>{StrBegin="NETSDK1213: "}</comment>
</data>
<data name="PreferNativeArm64IgnoredForNetCoreApp" xml:space="preserve">
<value>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</value>
<comment>{StrBegin="NETSDK1214: "}</comment>
</data>
<!-- The latest message added is Net8NotCompatibleWithDev177. Please update this value with each PR to catch parallel PRs both adding a new message -->
</root>

5
src/Tasks/Common/Resources/xlf/Strings.cs.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit se nepodporuje a nemá žádný vliv na cíl netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: Prostředky se používají z projektu {0}, ale v {1} se nenašla odpovídající cesta k projektu MSBuild.</target>

5
src/Tasks/Common/Resources/xlf/Strings.de.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit wird nicht unterstützt und hat keine Auswirkungen auf das netcoreapp-Ziel.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: Es werden Ressourcen aus dem Projekt "{0}" genutzt, in "{1}" wurde jedoch kein entsprechender MSBuild-Projektpfad gefunden.</target>

5
src/Tasks/Common/Resources/xlf/Strings.es.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit no se admite y no tiene efecto para el destino netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: Los recursos se consumen desde el proyecto "{0}", pero no se ha encontrado la ruta de acceso de proyecto de MSBuild correspondiente en "{1}".</target>

5
src/Tasks/Common/Resources/xlf/Strings.fr.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit nest pas pris en charge et na aucun effet pour la cible netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: Les composants sont consommés à partir du projet '{0}', mais il n'existe aucun chemin de projet MSBuild correspondant dans '{1}'.</target>

5
src/Tasks/Common/Resources/xlf/Strings.it.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit non è supportato e non ha alcun effetto per la destinazione netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: le risorse vengono utilizzate dal progetto '{0}', ma non è stato trovato alcun percorso di progetto MSBuild corrispondente in '{1}'.</target>

5
src/Tasks/Common/Resources/xlf/Strings.ja.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit はサポートされておらず、netcoreapp ターゲットには影響しません。</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: プロジェクト '{0}' の資産が使用されますが、対応する MSBuild プロジェクト パスが '{1}' で見つかりませんでした。</target>

5
src/Tasks/Common/Resources/xlf/Strings.ko.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit는 지원되지 않으며 netcoreapp 대상에는 영향을 주지 않습니다.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: '{0}' 프로젝트의 자산이 사용되었지만, '{1}'에서 해당 MSBuild 프로젝트 경로를 찾을 수 없습니다.</target>

5
src/Tasks/Common/Resources/xlf/Strings.pl.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: element Prefer32Bit nie jest obsługiwany i nie ma wpływu na element docelowy netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: Zasoby są używane z projektu „{0}”, ale w elemencie „{1}” nie odnaleziono odpowiadającej ścieżki projektu MSBuild.</target>

5
src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit não é suportado e não tem efeito para o destino netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: Os ativos são consumidos de um projeto '{0}', mas não foi encontrado nenhum caminho de projeto do MSBuild correspondente em '{1}'.</target>

5
src/Tasks/Common/Resources/xlf/Strings.ru.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit не поддерживается и не оказывает влияния на целевой объект netcoreapp.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: используются ресурсы из проекта "{0}", но соответствующий путь к проекту MSBuild не найден в "{1}".</target>

5
src/Tasks/Common/Resources/xlf/Strings.tr.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit desteklenmez ve netcoreapp hedefi için hiçbir etkisi yoktur.</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: '{0}' projesindeki varlıklar kullanılıyor, ancak '{1}' içinde karşılık gelen bir MSBuild proje yolu bulunamadı.</target>

5
src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: Prefer32Bit 不受支持,对 netcoreapp 目标无效。</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: 从项目“{0}”消耗资产,但在“{1}”中找不到相应的 MSBuild 项目路径。</target>

5
src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf сгенерированный
Просмотреть файл

@ -751,6 +751,11 @@ The following are names of parameters or literal values and should not be transl
<target state="translated">NETSDK1189: 不支援 Prefer32Bit且對 netcoreapp 目標沒有影響。</target>
<note>{StrBegin="NETSDK1189: "}</note>
</trans-unit>
<trans-unit id="PreferNativeArm64IgnoredForNetCoreApp">
<source>NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</source>
<target state="new">NETSDK1214: PreferNativeArm64 applies only to .NET Framework targets. It is not supported and has no effect for when targeting .NET Core.</target>
<note>{StrBegin="NETSDK1214: "}</note>
</trans-unit>
<trans-unit id="ProjectAssetsConsumedWithoutMSBuildProjectPath">
<source>NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'.</source>
<target state="translated">NETSDK1011: 已從專案 '{0}' 取用資產,但在 '{1}' 中找不到相對應的 MSBuild 專案路徑。</target>

Просмотреть файл

@ -284,6 +284,18 @@ Copyright (c) .NET Foundation. All rights reserved.
</Target>
<Target Name="_CheckAndUnsetUnsupportedPreferNativeArm64"
BeforeTargets="_CheckForInvalidConfigurationAndPlatform"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(PreferNativeArm64)' == 'true'">
<NETSdkWarning ResourceName="PreferNativeArm64IgnoredForNetCoreApp" />
<PropertyGroup>
<PreferNativeArm64>false</PreferNativeArm64>
</PropertyGroup>
</Target>
<Target Name="_CheckForMismatchingPlatform"
BeforeTargets="_CheckForInvalidConfigurationAndPlatform"
Condition="'$(RuntimeIdentifier)' != '' and '$(PlatformTarget)' != ''">

Просмотреть файл

@ -113,6 +113,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<AllowUnsafeBlocks Condition="'$(AllowUnsafeBlocks)'==''">false</AllowUnsafeBlocks>
<TreatWarningsAsErrors Condition="'$(TreatWarningsAsErrors)'==''">false</TreatWarningsAsErrors>
<Prefer32Bit Condition="'$(Prefer32Bit)'==''">false</Prefer32Bit>
<PreferNativeArm64 Condition="'$(PreferNativeArm64)'==''">false</PreferNativeArm64>
<SignAssembly Condition="'$(SignAssembly)'==''">false</SignAssembly>
<DelaySign Condition="'$(DelaySign)'==''">false</DelaySign>
<GeneratePackageOnBuild Condition="'$(GeneratePackageOnBuild)'==''">false</GeneratePackageOnBuild>

Просмотреть файл

@ -590,5 +590,48 @@ namespace Microsoft.NET.Build.Tests
.And
.HaveStdOutContaining("Hello World!");
}
[Theory]
[InlineData(ToolsetInfo.CurrentTargetFramework)]
public void It_builds_a_runnable_output_with_PreferNativeArm64(string targetFramework)
{
if (!EnvironmentInfo.SupportsTargetFramework(targetFramework))
{
return;
}
var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework);
var testAsset = _testAssetsManager
.CopyTestAsset("HelloWorld", identifier: targetFramework)
.WithSource()
.WithTargetFramework(targetFramework)
.WithProjectChanges(project =>
{
var ns = project.Root.Name.Namespace;
var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First();
propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier));
propertyGroup.Add(new XElement(ns + "PreferNativeArm64", "true"));
});
var buildCommand = new BuildCommand(testAsset);
buildCommand
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining(Strings.PreferNativeArm64IgnoredForNetCoreApp);
var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier);
var selfContainedExecutable = $"HelloWorld{Constants.ExeSuffix}";
string selfContainedExecutableFullPath = Path.Combine(outputDirectory.FullName, selfContainedExecutable);
new RunExeCommand(Log, selfContainedExecutableFullPath)
.Execute()
.Should()
.Pass()
.And
.HaveStdOutContaining("Hello World!");
}
}
}