From b52749cae4fda6efaa6123bb7dcab29ad5b24a64 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Thu, 16 Nov 2023 11:34:40 -1000 Subject: [PATCH] =?UTF-8?q?=EF=BB=BF[Xamarin.Android.Build.Tasks]=20Emit?= =?UTF-8?q?=20warnings=20if=20using=20deprecated=20bindings=20fallback=20f?= =?UTF-8?q?lags.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Documentation/guides/messages/README.md | 1 + Documentation/guides/messages/xa1037.md | 22 +++++++++++++++++++ .../Xamarin.Android.Bindings.Core.targets | 13 +++++++++++ .../Microsoft.Android.Sdk.BuildOrder.targets | 1 + ...soft.Android.Sdk.DefaultProperties.targets | 2 +- .../Properties/Resources.Designer.cs | 9 ++++++++ .../Properties/Resources.resx | 6 +++++ 7 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 Documentation/guides/messages/xa1037.md diff --git a/Documentation/guides/messages/README.md b/Documentation/guides/messages/README.md index ca0a392aa25..bab9d5dc5d0 100644 --- a/Documentation/guides/messages/README.md +++ b/Documentation/guides/messages/README.md @@ -138,6 +138,7 @@ or 'Help->Report a Problem' in Visual Studio for Mac. + [XA1035](xa1035.md): The 'BundleAssemblies' property is deprecated and it has no effect on the application build. Equivalent functionality is implemented by the 'AndroidUseAssemblyStore' and 'AndroidEnableAssemblyCompression' properties. + [XA1036](xa1036.md): AndroidManifest.xml //uses-sdk/@android:minSdkVersion '29' does not match the $(SupportedOSPlatformVersion) value '21' in the project file (if there is no $(SupportedOSPlatformVersion) value in the project file, then a default value has been assumed). Either change the value in the AndroidManifest.xml to match the $(SupportedOSPlatformVersion) value, or remove the value in the AndroidManifest.xml (and add a $(SupportedOSPlatformVersion) value to the project file if it doesn't already exist). ++ [XA1037](xa1037.md): The '{0}' MSBuild property is deprecated and will be removed in .NET {1}. See https://aka.ms/net-android-deprecations for more details. ## XA2xxx: Linker diff --git a/Documentation/guides/messages/xa1037.md b/Documentation/guides/messages/xa1037.md new file mode 100644 index 00000000000..c81e6b2817e --- /dev/null +++ b/Documentation/guides/messages/xa1037.md @@ -0,0 +1,22 @@ +--- +title: Xamarin.Android warning XA1037 +description: XA1037 warning code +ms.date: 27/11/2023 +--- +# Xamarin.Android warning XA1037 + +## Example messages + +``` +The '_AndroidUseJavaLegacyResolver' MSBuild property is deprecated and will be removed in .NET 10. +See https://aka.ms/net-android-deprecations for more details. +``` + +## Solution + +Edit your csproj directly and remove the referenced MSBuild property. + +Test your project to ensure the new behavior is functionally equivalent. + +If not, file an [issue](https://github.com/xamarin/xamarin-android/issues) so a +solution can be found before the deprecated flag is removed. diff --git a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Core.targets b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Core.targets index e4fd97abeea..107a95fe476 100644 --- a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Core.targets +++ b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Bindings.Core.targets @@ -33,6 +33,19 @@ It is shared between "legacy" binding projects and .NET 5 projects. $(NoWarn);CS1573;CS1591 + + + + + diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets index 346c89aa99b..19d0c698d1f 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BuildOrder.targets @@ -82,6 +82,7 @@ properties that determine build ordering. _ValidateLinkMode; + _CheckNonIdealBindingConfigurations; _SetupMSBuildAllProjects; _SetupDesignTimeBuildForBuild; _CategorizeAndroidLibraries; diff --git a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets index 3aeea8cf67b..034743e2bf0 100644 --- a/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets +++ b/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets @@ -39,7 +39,7 @@ true true true - <_AndroidEmitLegacyInterfaceInvokers Condition=" '$(AndroidEmitLegacyInterfaceInvokers)' == '' ">false + <_AndroidEmitLegacyInterfaceInvokers Condition=" '$(_AndroidEmitLegacyInterfaceInvokers)' == '' ">false true obsolete diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs index 525498f9096..4e612a10019 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.Designer.cs @@ -737,6 +737,15 @@ public static string XA1028 { } } + /// + /// Looks up a localized string similar to The '{0}' MSBuild property is deprecated and will be removed in .NET {1}. See https://aka.ms/net-android-deprecations for more details.. + /// + public static string XA1037 { + get { + return ResourceManager.GetString("XA1037", resourceCulture); + } + } + /// /// Looks up a localized string similar to Use of AppDomain.CreateDomain() detected in assembly: {0}. .NET 6 and higher will only support a single AppDomain, so this API will no longer be available in Xamarin.Android once .NET 6 is released.. /// diff --git a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx index 5eeed4389f3..43a90d49729 100644 --- a/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx +++ b/src/Xamarin.Android.Build.Tasks/Properties/Resources.resx @@ -996,4 +996,10 @@ To use a custom JDK path for a command line build, set the 'JavaSdkDirectory' MS The following are literal names and should not be translated: Maven {0} - User supplied Maven repository type + + The '{0}' MSBuild property is deprecated and will be removed in .NET {1}. See https://aka.ms/net-android-deprecations for more details. + The following are literal names and should not be translated: MSBuild, .NET. +{0} - The deprecated MSBuild property name +{1} - The numeric version of .NET + \ No newline at end of file