diff --git a/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx b/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx
index 73f4ff1ab063..f85052143906 100644
--- a/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx
+++ b/msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx
@@ -1620,6 +1620,10 @@
Unable to copy the inputs to this task to the remote build server for unknown reasons. The build log may have more information.
+
+ The task '{0}' is trying to call an external process, but a path to Xcode has not been provided. Please file an issue at https://github.com/dotnet/macios/issues/new/choose.
+
+
The task '{0}' requires the property '{1}' to be set. Please file an issue at https://github.com/dotnet/macios/issues/new/choose.
diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs
index d52727b1a4be..f25ef2fd388c 100644
--- a/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs
+++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/XamarinTask.cs
@@ -111,17 +111,23 @@ protected string GetSdkPlatform (bool isSimulator)
internal protected System.Threading.Tasks.Task ExecuteAsync (string fileName, IList arguments, Dictionary? environment = null, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null)
{
- return ExecuteAsync (Log, fileName, arguments, SdkDevPath, environment, showErrorIfFailure, workingDirectory, cancellationToken);
+ return ExecuteAsync (this, fileName, arguments, SdkDevPath, environment, showErrorIfFailure, workingDirectory, cancellationToken);
}
static int executionCounter;
- static async System.Threading.Tasks.Task ExecuteAsync (TaskLoggingHelper log, string fileName, IList arguments, string? sdkDevPath = null, Dictionary? environment = null, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null)
+ static async System.Threading.Tasks.Task ExecuteAsync (Task task, string fileName, IList arguments, string? sdkDevPath = null, Dictionary? environment = null, bool showErrorIfFailure = true, string? workingDirectory = null, CancellationToken? cancellationToken = null)
{
+ var log = task.Log;
// Create a new dictionary if we're given one, to make sure we don't change the caller's dictionary.
var launchEnvironment = environment is null ? new Dictionary () : new Dictionary (environment);
if (!string.IsNullOrEmpty (sdkDevPath))
launchEnvironment ["DEVELOPER_DIR"] = sdkDevPath;
+ if (Environment.OSVersion.Platform == PlatformID.MacOSX && string.IsNullOrEmpty (sdkDevPath)) {
+ log.LogWarning (MSBStrings.E7164 /* The task '{0}' is trying to call an external process, but a path to Xcode has not been provided. Please file an issue at https://github.com/dotnet/macios/issues/new/choose. */, task.GetType ().Name);
+ log.LogMessage (MessageImportance.Low, Environment.StackTrace);
+ }
+
var currentId = Interlocked.Increment (ref executionCounter);
log.LogMessage (MessageImportance.Normal, MSBStrings.M0001, currentId, fileName, StringUtils.FormatArguments (arguments)); // Started external tool execution #{0}: {1} {2}
if (!string.IsNullOrEmpty (workingDirectory)) {
diff --git a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs
index ad487abb6993..a039a785ba74 100644
--- a/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs
+++ b/tests/msbuild/Xamarin.MacDev.Tasks.Tests/TestHelpers/TestBase.cs
@@ -53,6 +53,8 @@ public virtual void Setup ()
{
var t = new T ();
t.BuildEngine = Engine;
+ if (t is XamarinTask xt)
+ xt.SdkDevPath = Configuration.xcode_root;
return t;
}