diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 80a7449e71bf..bed4b2b282f3 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1686,7 +1686,7 @@ <_NativeReferences Include="@(_FileNativeReference)" Condition="'%(_FileNativeReference.LinkToExecutable)' != 'false'" /> - + @@ -1859,7 +1859,6 @@ diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs index 2c3149e5f8bd..512906356e03 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/LinkNativeCode.cs @@ -31,7 +31,8 @@ public class LinkNativeCode : XamarinTask, ITaskCallback { public string SdkRoot { get; set; } = string.Empty; [Required] - public string OutputFile { get; set; } = string.Empty; + [Output] + public ITaskItem OutputFile { get; set; } = null!; [Required] public ITaskItem [] ObjectFiles { get; set; } = Array.Empty (); @@ -56,7 +57,7 @@ public class LinkNativeCode : XamarinTask, ITaskCallback { public override bool Execute () { if (ShouldExecuteRemotely ()) { - outputPath = PathUtils.ConvertToMacPath (Path.GetDirectoryName (OutputFile)); + outputPath = PathUtils.ConvertToMacPath (Path.GetDirectoryName (OutputFile.ItemSpec)); return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result; } @@ -205,7 +206,7 @@ bool ExecuteUnsafe () arguments.AddRange (GetEmbedEntitlementsWithDerInExecutableLinkerFlags (EntitlementsInExecutable)); arguments.Add ("-o"); - arguments.Add (Path.GetFullPath (OutputFile)); + arguments.Add (Path.GetFullPath (OutputFile.ItemSpec)); if (LinkerFlags is not null) { foreach (var flag in LinkerFlags) @@ -306,7 +307,7 @@ static bool EntitlementsRequireLinkerFlags (string path) // and the ones on Windows are empty, so we will break the build public bool ShouldCopyToBuildServer (ITaskItem item) => !PathUtils.ConvertToMacPath (item.ItemSpec).StartsWith (outputPath); - public bool ShouldCreateOutputFile (ITaskItem item) => false; + public bool ShouldCreateOutputFile (ITaskItem item) => true; public IEnumerable GetAdditionalItemsToBeCopied () => Enumerable.Empty (); }