anchor.diff:      |> CleanDirs 
   )
   
  -Target "BuildNumber" (fun _ ->
  -    use tb = getTfsBuild()
  -    tb.Build.BuildNumber <- sprintf "SourceLink.%s" buildVersion
  -    tb.Build.Save()
  -)
  -
   Target "BuildVersion" (fun _ ->
  -    logfn "cmd /c where where"
  -    let rv = Shell.Exec("cmd", "/c where where")
  -    logfn "  rv: %d" rv
  -
  -    logfn "cmd /c where appveyor"
  -    let rv = Shell.Exec("cmd", "/c where appveyor")
  -    logfn "  rv: %d" rv
  -
       let args = sprintf "UpdateBuild -Version \"%s\"" buildVersion
       let rv = Shell.Exec("appveyor", args)
       logfn "appveyor %s, exit code %d" args rv
  
positive.code: )
  
  "Clean"
      =?> ("AppVeyor", isAppVeyorBuild)
      =?> ("BuildNumber", isTfsBuild)
      =?> ("BuildVersion", isAppVeyorBuild)
      ==> "AssemblyInfo"
      ==> "Build"
  
negative.code: let revision =
      use repo = new GitRepo(__SOURCE_DIRECTORY__)
      repo.Revision
  //let revision8 = if revision = "" then "" else "-"+revision.Substring(0,8)
  
  let versionAssembly = cfg.AppSettings.["versionAssembly"].Value // change when incompatible
  let versionFile = cfg.AppSettings.["versionFile"].Value // matches nuget version
  let prerelease =
      if hasBuildParam "prerelease" then getBuildParam "prerelease"
      else sprintf "ci%s" (dt.ToString "yyMMddHHmm") // 20 char limit
  let versionInfo = sprintf "%s %s %s" versionAssembly (dt.ToString "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'") revision
  let buildVersion = if String.IsNullOrEmpty prerelease then versionFile else sprintf "%s-%s" versionFile prerelease
  
  let isAppVeyorBuild = environVar "APPVEYOR" <> null
  
  Target "Clean" (fun _ -> 
      !! "**/bin/"
  