Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ public Copy() { }
public Microsoft.Build.Framework.ITaskItem[] SourceFiles { get { throw null; } set { } }
public bool UseHardlinksIfPossible { get { throw null; } set { } }
public bool UseSymboliclinksIfPossible { get { throw null; } set { } }
[Microsoft.Build.Framework.OutputAttribute]
public bool WroteAtLeastOneFile { get { throw null; } }
public void Cancel() { }
public override bool Execute() { throw null; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public Copy() { }
public Microsoft.Build.Framework.ITaskItem[] SourceFiles { get { throw null; } set { } }
public bool UseHardlinksIfPossible { get { throw null; } set { } }
public bool UseSymboliclinksIfPossible { get { throw null; } set { } }
[Microsoft.Build.Framework.OutputAttribute]
public bool WroteAtLeastOneFile { get { throw null; } }
public void Cancel() { }
public override bool Execute() { throw null; }
}
Expand Down
6 changes: 6 additions & 0 deletions src/Tasks/Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ public Copy()
[Output]
public ITaskItem[] CopiedFiles { get; private set; }

[Output]
public bool WroteAtLeastOneFile { get; private set; }

/// <summary>
/// Whether to overwrite files in the destination
/// that have the read-only attribute set.
Expand Down Expand Up @@ -298,6 +301,9 @@ FileState destinationFileState // The destination file

File.Copy(sourceFileState.Name, destinationFileState.Name, true);
}

// Files were successfully copied or linked. Those are equivalent here.
WroteAtLeastOneFile = true;

destinationFileState.Reset();

Expand Down
3 changes: 2 additions & 1 deletion src/Tasks/Microsoft.Common.CurrentVersion.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4690,6 +4690,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<Output TaskParameter="DestinationFiles" ItemName="FileWritesShareable"/>
<Output TaskParameter="CopiedFiles" ItemName="ReferencesCopiedInThisBuild"/>
<Output TaskParameter="WroteAtLeastOneFile" PropertyName="WroteAtLeastOneFile"/>

</Copy>

Expand All @@ -4699,7 +4700,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
input to projects that reference this one. -->
<Touch Files="@(CopyUpToDateMarker)"
AlwaysCreate="true"
Condition="'@(ReferencesCopiedInThisBuild)' != ''">
Condition="'@(ReferencesCopiedInThisBuild)' != '' and '$(WroteAtLeastOneFile)' == 'true'">
<Output TaskParameter="TouchedFiles" ItemName="FileWrites" />
</Touch>

Expand Down