Search code examples
monoxbuild

Does xbuild really not implement the Move task?


Am I missing something, or does xbuild really not implement the <Move> task? I'm trying to build a cross-platform C# project using MSBuild files for everything so there will be less difference between Windows and Linux in our project, and my MSBuild file looks a little like this:

<Copy SourceFiles="$(SrcDir)/$(FirstFile);$(SrcDir)/$(SecondFile)" DestinationFolder="$(DestDir)" />
<Move SourceFiles="$(DestDir)/$(SecondFile)" DestinationFile="$(DestDir)/$(NewFileNameForSecondFile)" />

But when I run xbuild, it complains:

Error initializing task Move: Not registered task Move.

What am I missing? I know that xbuild doesn't implement some of MSBuild's more recent and/or more advanced features — I've had to work around a few of those omissions — but the <Move> task seems like a really, really basic one. Is it really not implemented in xbuild, or am I missing something obvious?


Solution

  • I think Move falls under TaskExtensions within MSBuild. You would need to convert it to a Copy and Delete or multiple platform specific Tasks:

    List of TaskNames in xbuild (mono 4.2.x):

    cd mono/mcs/tools/xbuild
    grep -RI "TaskName=" * | cut -d "=" -f 2 | cut -d "      " -f 1 | sort | uniq
    "Microsoft.Build.Tasks.AL"
    "Microsoft.Build.Tasks.AssignCulture"
    "Microsoft.Build.Tasks.AssignLinkMetadata"
    "Microsoft.Build.Tasks.AssignProjectConfiguration"
    "Microsoft.Build.Tasks.AssignTargetPath"
    "Microsoft.Build.Tasks.CallTarget"
    "Microsoft.Build.Tasks.CombinePath"
    "Microsoft.Build.Tasks.Copy"
    "Microsoft.Build.Tasks.CreateCSharpManifestResourceName"
    "Microsoft.Build.Tasks.CreateItem"
    "Microsoft.Build.Tasks.CreateProperty"
    "Microsoft.Build.Tasks.CreateVisualBasicManifestResourceName"
    "Microsoft.Build.Tasks.Csc"
    "Microsoft.Build.Tasks.Delete"
    "Microsoft.Build.Tasks.Error"
    "Microsoft.Build.Tasks.Exec"
    "Microsoft.Build.Tasks.FindAppConfigFile"
    "Microsoft.Build.Tasks.FindUnderPath"
    "Microsoft.Build.Tasks.GenerateResource"
    "Microsoft.Build.Tasks.GetAssemblyIdentity"
    "Microsoft.Build.Tasks.GetFrameworkPath"
    "Microsoft.Build.Tasks.GetFrameworkSdkPath"
    "Microsoft.Build.Tasks.GetReferenceAssemblyPaths"
    "Microsoft.Build.Tasks.LC"
    "Microsoft.Build.Tasks.MSBuild"
    "Microsoft.Build.Tasks.MakeDir"
    "Microsoft.Build.Tasks.Message"
    "Microsoft.Build.Tasks.ReadLinesFromFile"
    "Microsoft.Build.Tasks.RemoveDir"
    "Microsoft.Build.Tasks.RemoveDuplicates"
    "Microsoft.Build.Tasks.ResolveAssemblyReference"
    "Microsoft.Build.Tasks.SignFile"
    "Microsoft.Build.Tasks.Touch"
    "Microsoft.Build.Tasks.Vbc"
    "Microsoft.Build.Tasks.Warning"
    "Microsoft.Build.Tasks.WriteCodeFragment"
    "Microsoft.Build.Tasks.WriteLinesToFile"