dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.35k forks source link

UseHardlinksIfPossible, readonly attributes and TFS issue #473

Open KotM opened 8 years ago

KotM commented 8 years ago

Microsoft.Build.Tasks.Copy supports UseHardlinksIfPossible property. Unfortunately, using this property causes the issue with coping the files originally located at TFS (workspace location should be set to Server). This task clears all attributes of a destination files, but in case of hard link original and destination files are the same, so original files also changes their attributes (especially readonly one).

And next time on updating TFS can cause conflicting issue, because in Server mode workspace lack of readonly attribute means that the file has been changed and needed for merging.

I'd advise to perform small change at 351 line of Cope.cs file, something like this:

if (sourceFileState.IsReadOnly && !hardLinkCreated)

Or better implement additional property which will indicate what we should do with hard links attributes.

AndyGerlicher commented 8 years ago

This seems like it's doing the wrong thing if this is correct. Assigning up-for-grabs, we would accept this as long as a test is included for the scenario.