Skip to content

Commit b99253a

Browse files
committed
[msbuild] Add CopyToWindows to WriteLinesToFile
Allow remote WriteLinesToFile tasks to copy their generated file back to Windows when requested, while preserving existing local behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e9d84281-7deb-4b10-9c48-282faafc8f34
1 parent 832df68 commit b99253a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

msbuild/Xamarin.MacDev.Tasks/MsBuildTasks/WriteLinesToFile.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@
66
namespace Microsoft.Build.Tasks {
77
public class WriteLinesToFile : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.WriteLinesToFile, IHasSessionId {
88
public string SessionId { get; set; } = string.Empty;
9+
public bool CopyToWindows { get; set; }
10+
911
public override bool Execute ()
1012
{
11-
if (this.ShouldExecuteRemotely (SessionId))
12-
return XamarinTask.ExecuteRemotely (this);
13+
if (this.ShouldExecuteRemotely (SessionId)) {
14+
if (!XamarinTask.ExecuteRemotely (this, out var taskRunner))
15+
return false;
16+
17+
if (CopyToWindows)
18+
XamarinTask.CopyFilesToWindowsAsync (this, taskRunner, new [] { File }).Wait ();
19+
20+
return true;
21+
}
1322

1423
return base.Execute ();
1524
}

0 commit comments

Comments
 (0)