From c98d9fe6aa7c14fe3b4fd0296ac8bfaa64ba2aa3 Mon Sep 17 00:00:00 2001 From: Jonathan Peppers Date: Fri, 11 Aug 2023 14:53:22 -0500 Subject: [PATCH] [build] set file extension for common `ToolExe` values Running the `-t:Install` target with a local xamarin-android build on Windows, I got the error: AndroidAdb Errors Xamarin.Android.Common.targets(2641,3): error MSB6004: The specified task executable location "D:\android-toolchain\sdk\platform-tools\adb" is invalid. This appears to only happen with a local of xamarin/xamarin-android because it specifies `AdbToolExe=adb` in `Configuration.props`. It appears that most of our tasks just use the pattern: protected override string GenerateFullPathToTool () { return Path.Combine (ToolPath, ToolExe); } Where if `ToolExe` was completely blank, it would fall back to the value: protected override string ToolName => OS.IsWindows ? "adb.exe" : "adb"; Searching the web: https://grep.app/search?current=2&q=ToolExe&words=true&filter[lang][0]=C%23&filter[lang][1]=XML It seems most other tasks use `ToolExe` as-is, if it is passed in. Where most of the time the default value is blank. So, I think the simple fix here, is to specify the file extension in `Configuration.props` for any of our `$(FooToolExe)` values. I also removed `$(AndroidToolExe)` because it is unused and may not event exist anymore in the Android SDK. --- Configuration.props | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Configuration.props b/Configuration.props index c600f3705bd..47798861fbf 100644 --- a/Configuration.props +++ b/Configuration.props @@ -180,12 +180,13 @@ $(AndroidSdkFullPath)\platform-tools\ - adb + adb + adb.exe $(AndroidToolchainDirectory) - avdmanager + avdmanager + avdmanager.bat $(AndroidSdkFullPath)\tools $(AndroidToolPath)\bin - android 7.0 8512546_latest $(AndroidSdkFullPath)\cmdline-tools\$(CommandLineToolsFolder)\bin @@ -193,7 +194,8 @@ 9364964 32.1.9 $(AndroidSdkFullPath)\emulator - emulator + emulator + emulator.exe $(AndroidNdkDirectory)\ndk-build $(AndroidNdkDirectory)\ndk-build.cmd $(MicrosoftAndroidSdkOutDir)bundletool.jar