anchor.diff:          project.Properties.Item("FullPath").Value.ToString()
   
       let getFullFilePathInScriptFolder project fileName = 
  -        let projectFolder = getProjectFolder project
  -        let scriptFolder = projectFolder </> scriptFolderName
  -        if not (Directory.Exists scriptFolder) then
  -            Directory.CreateDirectory(scriptFolder) |> ignore
  +        let scriptFolder = getProjectFolder project </> scriptFolderName
  +        Directory.CreateDirectory scriptFolder |> ignore
           scriptFolder </> fileName
   
       let addFileToActiveProject(project: Project, fileName: string, content: string) = 
           if isFSharpProject project then
               let textFile = getFullFilePathInScriptFolder project fileName
  -            use writer = File.CreateText(textFile)
  -            writer.Write(content)
  -
  +            if not (File.Exists textFile) || File.ReadAllText textFile <> content then
  +                use writer = File.CreateText textFile
  +                writer.Write content 
  +
  +            let isProjectDirty = ref false
               let projectFolderScript = 
  -                project.ProjectItems.Item(scriptFolderName)
  +                project.ProjectItems.Item scriptFolderName
                   |> Option.ofNull
                   |> Option.getOrTry (fun _ ->
  -                    project.ProjectItems.AddFolder(scriptFolderName))
  -            projectFolderScript.ProjectItems.AddFromFile(textFile) |> ignore
  -            project.Save()
  +                    isProjectDirty := true
  +                    project.ProjectItems.AddFolder scriptFolderName)
  +            projectFolderScript.ProjectItems.Item fileName
  +            |> Option.ofNull
  +            |> function
  +               | None ->
  +                   isProjectDirty := true
  +                   projectFolderScript.ProjectItems.AddFromFile textFile |> ignore
  +               | _ -> ()
  +            if !isProjectDirty then project.Save()
   
       let getActiveProjectOutput (project: Project) =
           Option.attempt <| fun _ ->
  
positive.code:         let fileUri = Uri file
          // Folders must end in a slash
          let folder =
              if not <| folder.EndsWith (Path.DirectorySeparatorChar.ToString()) then
                  folder + string Path.DirectorySeparatorChar
              else folder
          let folderUri = Uri folder
  
negative.code:     let generateFileContent (refLines: #seq<string>) =
          String.Join(Environment.NewLine, headerComment, String.Join(Environment.NewLine, refLines))
  
      let getExistingFileRefs project fileName = 
          let filePath = getFullFilePathInScriptFolder project fileName  
          if File.Exists filePath then
              File.ReadLines filePath
              |> Seq.filter (fun (line: string) -> line.StartsWith "#r")
              |> Seq.toList
          else []
  
      let mergeRefs existing actual =
          // remove refs which don't actual anymore (they have been removed from the project)
  