From 58dbd6d81cc1d7bc63f537bc0343252c9f45639e Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Wed, 6 Dec 2023 10:55:24 -0600 Subject: [PATCH] [tests] trim trailing `\` from AndroidSdkDirectory/JavaSdkDirectory (#8564) When running MSBuild tests locally, both of the paths used for: /p:AndroidSdkDirectory="C:\Some Path\android-sdk\" /p:JavaSdkDirectory="C:\Some Path\jdk\" Because the two paths have a trailing `\`, it appears that MSBuild is escaping the `\"` giving an error message that we can't build more than one project! Basically, all command-line parsing is failing! I am unsure what changed, but making this change locally allows me to run the MSBuild tests again. --- .../Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs index e020fc89e85..f33cc4d9c45 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Common/DotNetCLI.cs @@ -154,10 +154,10 @@ List GetDefaultCommandLineArgs (string verb, string target = null, strin arguments.Add ($"/t:{target}"); } if (Directory.Exists (AndroidSdkPath)) { - arguments.Add ($"/p:AndroidSdkDirectory=\"{AndroidSdkPath}\""); + arguments.Add ($"/p:AndroidSdkDirectory=\"{AndroidSdkPath.TrimEnd('\\')}\""); } if (Directory.Exists (JavaSdkPath)) { - arguments.Add ($"/p:JavaSdkDirectory=\"{JavaSdkPath}\""); + arguments.Add ($"/p:JavaSdkDirectory=\"{JavaSdkPath.TrimEnd ('\\')}\""); } if (parameters != null) { foreach (var parameter in parameters) {