diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index f75e016b6e..04994f1ced 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,6 @@
-#### 3.4.0-alpha002 - 29.06.2016
+#### 3.4.0-alpha003 - 29.06.2016
* Using Argu 3 alpha channel
+* BUGFIX: auto-restore on fixes old targets file references - https://github.com/fsprojects/Paket/issues/1768
* BUGFIX: Added handling for cache not being accessible - https://github.com/fsprojects/Paket/pull/1764
* BUGFIX: Fixed out-of-date check for remote files - https://github.com/fsprojects/Paket/issues/1760, https://github.com/fsprojects/Paket/issues/1762, https://github.com/fsprojects/Paket/issues/1766
* BUGFIX: Using network cache with invalid credentials should not fail restore - https://github.com/fsprojects/Paket/issues/1758
diff --git a/src/Paket.Core/ProjectFile.fs b/src/Paket.Core/ProjectFile.fs
index 4bc9a3a83d..52cf86e291 100644
--- a/src/Paket.Core/ProjectFile.fs
+++ b/src/Paket.Core/ProjectFile.fs
@@ -1164,10 +1164,10 @@ module ProjectFile =
let node = createNode "Import" project |> addAttribute "Project" relativeTargetsPath
project.ProjectNode.AppendChild node |> ignore
- let removeImportForPaketTargets relativeTargetsPath (project:ProjectFile) =
+ let removeImportForPaketTargets (project:ProjectFile) =
project.Document
|> getDescendants "Import"
- |> List.tryFind (withAttributeValue "Project" relativeTargetsPath)
+ |> List.tryFind (withAttributeValueEndsWith "Project" Constants.TargetsFileName)
|> Option.iter (fun n -> n.ParentNode.RemoveChild n |> ignore)
let determineBuildAction fileName (project:ProjectFile) =
@@ -1302,7 +1302,7 @@ type ProjectFile with
member this.AddImportForPaketTargets relativeTargetsPath = ProjectFile.addImportForPaketTargets relativeTargetsPath this
- member this.RemoveImportForPaketTargets relativeTargetsPath = ProjectFile.removeImportForPaketTargets relativeTargetsPath this
+ member this.RemoveImportForPaketTargets() = ProjectFile.removeImportForPaketTargets this
member this.DetermineBuildAction fileName = ProjectFile.determineBuildAction fileName this
diff --git a/src/Paket.Core/VSIntegration.fs b/src/Paket.Core/VSIntegration.fs
index d6c0f7f5d6..b91678a4f3 100644
--- a/src/Paket.Core/VSIntegration.fs
+++ b/src/Paket.Core/VSIntegration.fs
@@ -8,36 +8,37 @@ open Domain
open Releases
open InstallProcess
-/// Activates the Visual Studio Nuget autorestore feature in all projects
-let TurnOnAutoRestore environment =
+/// Deactivates the Visual Studio NuGet autorestore feature in all projects
+let TurnOffAutoRestore environment =
let exeDir = Path.Combine(environment.RootDirectory.FullName, Constants.PaketFolderName)
-
+
trial {
- do! downloadLatestBootstrapperAndTargets environment
let paketTargetsPath = Path.Combine(exeDir, Constants.TargetsFileName)
+ do! removeFile paketTargetsPath
environment.Projects
|> List.map fst
|> List.iter (fun project ->
- let relativePath = createRelativePath project.FileName paketTargetsPath
- project.AddImportForPaketTargets(relativePath)
+ project.RemoveImportForPaketTargets()
project.Save(false)
)
- }
+ }
-/// Deactivates the Visual Studio Nuget autorestore feature in all projects
-let TurnOffAutoRestore environment =
+
+/// Activates the Visual Studio NuGet autorestore feature in all projects
+let TurnOnAutoRestore environment =
let exeDir = Path.Combine(environment.RootDirectory.FullName, Constants.PaketFolderName)
-
+
trial {
+ do! TurnOffAutoRestore environment
+ do! downloadLatestBootstrapperAndTargets environment
let paketTargetsPath = Path.Combine(exeDir, Constants.TargetsFileName)
- do! removeFile paketTargetsPath
environment.Projects
|> List.map fst
|> List.iter (fun project ->
let relativePath = createRelativePath project.FileName paketTargetsPath
- project.RemoveImportForPaketTargets(relativePath)
+ project.AddImportForPaketTargets(relativePath)
project.Save(false)
)
- }
+ }
\ No newline at end of file
diff --git a/src/Paket.Core/Xml.fs b/src/Paket.Core/Xml.fs
index 139c363208..7c76a3c98b 100644
--- a/src/Paket.Core/Xml.fs
+++ b/src/Paket.Core/Xml.fs
@@ -34,6 +34,14 @@ let inline getAttribute name (node:XmlNode) =
let inline withAttributeValue attributeName valueText node =
getAttribute attributeName node = Some valueText
+
+/// [omit]
+let inline withAttributeValueEndsWith attributeName valueText node =
+ match getAttribute attributeName node with
+ | Some text when text.EndsWith valueText -> true
+ | _ -> false
+
+
/// [omit]
let inline optGetAttribute name node = node |> Option.bind (getAttribute name)
diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj
index ce3ab37362..851a0d4fd5 100644
--- a/src/Paket/Paket.fsproj
+++ b/src/Paket/Paket.fsproj
@@ -51,8 +51,8 @@
D:\code\PaketKopie
update -f
D:\code\Paket\integrationtests\scenarios\i001117-aws\temp
- update
- D:\code\paketkopie
+ auto-restore on
+ D:\code\Paket.ImportTargets
11