Skip to content

Breaking change in Microsoft.Common.targets (UseSymboliclinksIfPossible) #928

@AndyGerlicher

Description

@AndyGerlicher

This is introduced in #742. We (community contribution!) added support for symbolic links on the Copy task. I just happened to be looking into an issue with Xamarin targets and stumbled upon an issue.

In Microsoft.Common.CurrentVersion.targets we now call Copy like:

<Copy
    SourceFiles = "@(_SourceItemsToCopyToOutputDirectory)"
    DestinationFiles = "@(_SourceItemsToCopyToOutputDirectory->'$(OutDir)%(TargetPath)')"
    OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
    Retries="$(CopyRetryCount)"
    RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
    UseHardlinksIfPossible="$(CreateHardLinksForAdditionalFilesIfPossible)"
    UseSymboliclinksIfPossible="$(CreateSymbolicLinksForAdditionalFilesIfPossible)"

I don't see any problem with this in general. However, the Xamarin targets (specifically iOS are the targets I'm looking at) add <UsingTask TaskName="Microsoft.Build.Tasks.Copy" AssemblyFile="Xamarin.iOS.Tasks.dll"/>. This causes all Copy tasks to use the one from Xamarin.iOS.Tasks.dll rather than the builtin. Unfortunetely, this Copy task derives from Microsoft.Build.Tasks.v4.0.dll which does not have the new UseSymboliclinksIfPossible property.

It seems like we have a few options. 1) Fix Xamarin targets to bind to a more recent version of MSBuild (Microsoft.Build.Tasks.Core). This would have implications as to what version the target could run on (MSBuild 14+) but would be preferable if that's ok. 2) Modify the targets to not specify the property unless it's set. This seems like it could be pretty ugly. Or 3) find a way to turn on this feature in a backwards compatible way?

@kzu do you have any input on this? Is option 1 something you could do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions