anchor.diff:                      | String.EqualsIC "LOCKED" ->
                           match m.Groups.["group"] with
                           | g when g.Success -> // this may as well include Main
  -                        
  +
                               let groupName = GroupName g.Value
                               match lockFile.Groups |> Map.tryFind groupName with
  -                            | Some group -> 
  +                            | Some group ->
                                   match group.Resolution |> Map.tryFind packageName with
                                   | Some resolvedPackage -> resolvedPackage.Version
                                   | None -> failwithf "The template file %s contains the placeholder %A, but no version was given for package %O in group %O in paket.lock" fileName requireText packageName groupName
                               | None -> failwithf "The template file %s contains the placeholder %A, but group %O was not found in paket.lock" fileName requireText groupName
  -                                      
  +
                           | _ -> // default to Main, _or_ any other group with warning
  -                            let mainGroup = lockFile.Groups.[Constants.MainDependencyGroup] 
  +                            let mainGroup = lockFile.Groups.[Constants.MainDependencyGroup]
                               match mainGroup.TryFind packageName with
                               | Some resolvedPackage -> resolvedPackage.Resolved.Version
                               | None ->
  -                                let packages = lockFile.GetGroupedResolution() |> Seq.filter (fun kv -> snd kv.Key = packageName) |> Seq.toList                
  +                                let packages = lockFile.GetGroupedResolution() |> Seq.filter (fun kv -> snd kv.Key = packageName) |> Seq.toList
                                   match packages with
                                   | [] -> failwithf "The template file %s contains the placeholder %A, but no version was given for package %O in paket.lock." fileName requireText packageName
                                   | [groupAndPackage] ->
                                       traceWarnfn "The template file %s contains the placeholder %A, but version for package %O was found in group %A." fileName requireText packageName (fst groupAndPackage.Key)
                                       groupAndPackage.Value.Version
  -                                | _ -> failwithf "The template file %s contains the placeholder %A, but more than one group contains package %O in paket.lock." fileName requireText packageName                                
  -                        
  -                    | String.EqualsIC "CURRENT" -> 
  +                                | _ -> failwithf "The template file %s contains the placeholder %A, but more than one group contains package %O in paket.lock." fileName requireText packageName
  +
  +                    | String.EqualsIC "CURRENT" ->
                           match specificVersions.TryFind (string packageName) with
                           | Some excplicitVersion -> excplicitVersion
                           | None ->
                               match currentVersion with
                               | Some thisVersion -> thisVersion
                               | None -> failwithf "The template file %s contains the placeholder %A, but no version was given." fileName requireText
  -                                                    
  +
                       | _ -> failwithf "The template file %s contains invalid placeholder %A" fileName line
  -            
  +
                   let versionParts = (sourceVersion.AsString |> String.split [|'-'; '+'|]).[0] |> String.split [|'.'|]
  -                let segmentCount = 
  +                let segmentCount =
                       match m.Groups.["spec"] with
                       | spec when spec.Success ->
                           match spec.Value with
                           | "[1]" | "Major" -> 1
                           | "[2]" | "Minor" -> 2
  -                        | "[3]" | "Patch" -> 3 
  +                        | "[3]" | "Patch" -> 3
                           | "[4]" | "Build" -> 4 // do not normalize zero builds away, if explicitly requested
                           | "[-1]" | "[-2]" | "[-3]" ->
  -                            let versionLength = 
  -                                versionParts |> Seq.rev // count non-zero segments, from original, NOT-normalized source 
  -                                |> Seq.takeWhile (fun i -> match bigint.TryParse i with | true, n -> n > 0I | _ -> false) 
  +                            let versionLength =
  +                                versionParts |> Seq.rev // count non-zero segments, from original, NOT-normalized source
  +                                |> Seq.takeWhile (fun i -> match bigint.TryParse i with | true, n -> n > 0I | _ -> false)
                                   |> Seq.length
                               versionLength + (int (spec.Value.Trim([|'['; ']'|])))
                           | _ -> failwithf "The template file %s contains invalid specification %s" fileName line
                       | _ -> 0
  -                    
  -                let targetVersion = 
  +
  +                let targetVersion =
                       match segmentCount with
                       | 1 | 2 | 3 | 4 -> String.Join(".", versionParts, 0, Math.Min(versionParts.Length, Math.Max(0, segmentCount)))
                       | _ -> sourceVersion.AsString
  -                
  +
                   let targetReplaced = m.Result(sprintf "$`%s$'" targetVersion).Trim("@!".ToCharArray())
                   versionReplace targetReplaced
  -                 
  +
               | _ -> requireText
  -                
  -        let versionString = versionReplace rawRequirement                
  +
  +        let versionString = versionReplace rawRequirement
           let versionRequirement = DependenciesFileParser.parseVersionRequirement versionString
           Some (packageName, versionRequirement)
   
  
positive.code:     let private getFiles (map : Map<string, string>) =
          match Map.tryFind "files" map with
          | None -> []
          | Some d -> 
              d.Split '\n'
              |> Array.filter (fun s -> not (String.IsNullOrWhiteSpace s || isExclude.IsMatch s || isComment.IsMatch s))
              |> Seq.map (fun (line:string) ->
                  let splitted = 
                      line.Split([|"==>"|],StringSplitOptions.None)
                      |> Array.collect (fun line -> line.Split([|"=>"|],StringSplitOptions.None))
                      |> Array.map String.trim
  
negative.code:           References = []
            FrameworkAssemblyReferences = []
            Files = []
            FilesExcluded = []
            PackageTypes = []
            IncludeReferencedProjects = false
            IncludePdbs = false
  