Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#### 3.0.0-alpha095 - 31.03.2016
#### 3.0.0-alpha096 - 04.04.2016
* Allow to reference git repositories - http://fsprojects.github.io/Paket/git-dependencies.html
* Allow to run build commands on git repositories - http://fsprojects.github.io/Paket/git-dependencies.html#Running-a-build-in-git-repositories
* Allow to use git repositories as NuGet source - http://fsprojects.github.io/Paket/git-dependencies.html#Using-Git-repositories-as-NuGet-source
* Additional local caches - http://fsprojects.github.io/Paket/caches.html
* Garbage collection in packages folder - https://github.com/fsprojects/Paket/pull/1491
* BREAKING CHANGE: Removed --hard parameter from all commands. Paket threads all commands as if --hard would have been set - https://github.com/fsprojects/Paket/pull/1567

#### 2.57.1 - 30.03.2016
* BUGFIX: Property Definitions: placed after csharp targets - https://github.com/fsprojects/Paket/pull/1522
Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
It's also possible to add a package to a specified project only:

[lang=batchfile]
$ paket add nuget PACKAGENAME [version VERSION] [project PROJECT] [--force] [--hard]
$ paket add nuget PACKAGENAME [version VERSION] [project PROJECT] [--force]

See also [paket remove](paket-remove.html).

Expand Down
2 changes: 1 addition & 1 deletion docs/content/commands/remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
It's also possible to remove a package from a specified project only:

[lang=batchfile]
$ paket remove nuget PACKAGENAME [project PROJECT] [--force] [--hard]
$ paket remove nuget PACKAGENAME [project PROJECT] [--force]

See also [paket add](paket-add.html).
18 changes: 6 additions & 12 deletions docs/content/commands/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
If you do not specify a package, then all packages from paket.dependencies are updated.

[lang=batchfile]
paket update [--force|-f] [--hard] [--redirects] [--no-install]
paket update [--force|-f] [--redirects] [--no-install]

First, the current [`paket.lock` file](lock-file.html) is deleted. `paket update` then recomputes the current dependency resolution,
as explained under [Package resolution algorithm](http://fsprojects.github.io/Paket/resolver.html), and writes it to paket.lock.
Expand All @@ -15,19 +15,17 @@ Please see [`paket install`](paket-install.html) if you want to keep the current

`--force [-f]`: Forces the download and reinstallation of all packages.

`--hard`: Replaces package references within project files even if they are not yet adhering to the Paket's conventions (and hence considered manually managed). See [convert from NuGet](paket-convert-from-nuget.html).

`--redirects`: Creates binding redirects for the NuGet packages.

`--no-install`: Skips paket install --hard process afterward generation of [`paket.lock` file](lock-file.html).
`--no-install`: Skips paket install process afterward generation of [`paket.lock` file](lock-file.html).


## Updating a single package, or packages matching a pattern

It's also possible to update only specified packages and to keep all other dependencies fixed:

[lang=batchfile]
paket update nuget PACKAGENAME [version VERSION] [group GROUPNAME] [--force|-f] [--hard] [--redirects] [--no-install]
paket update nuget PACKAGENAME [version VERSION] [group GROUPNAME] [--force|-f] [--redirects] [--no-install]

### Options:

Expand All @@ -39,11 +37,9 @@ It's also possible to update only specified packages and to keep all other depen

`--force [-f]`: Forces the download and reinstallation of all packages.

`--hard`: Replaces package references within project files even if they are not yet adhering to the Paket's conventions (and hence considered manually managed). See [convert from NuGet](paket-convert-from-nuget.html).

`--redirects`: Creates binding redirects for the NuGet packages.

`--no-install`: Skips paket install --hard process afterward generation of [`paket.lock` file](lock-file.html).
`--no-install`: Skips paket install process afterward generation of [`paket.lock` file](lock-file.html).

`--filter`: Treat PACKAGENAME as a regex pattern to match against, rather than a single package. Enforces a "total" match (i.e. an implicit ^ and $ at beginning and end of PACKAGENAME)

Expand All @@ -52,19 +48,17 @@ It's also possible to update only specified packages and to keep all other depen
If you want to update a single group you can use the following command:

[lang=batchfile]
paket update group GROUPNAME [--force|-f] [--hard] [--redirects] [--no-install]
paket update group GROUPNAME [--force|-f] [--redirects] [--no-install]

### Options:

`group <string>`: Group name

`--force [-f]`: Forces the download and reinstallation of all packages.

`--hard`: Replaces package references within project files even if they are not yet adhering to the Paket's conventions (and hence considered manually managed). See [convert from NuGet](paket-convert-from-nuget.html).

`--redirects`: Creates binding redirects for the NuGet packages.

`--no-install`: Skips paket install --hard process afterward generation of [`paket.lock` file](lock-file.html).
`--no-install`: Skips paket install process afterward generation of [`paket.lock` file](lock-file.html).

## Updating http dependencies

Expand Down
2 changes: 1 addition & 1 deletion docs/content/convert-from-nuget-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ The `paket convert-from-nuget` command:
1. Finds all `packages.config` files, generates a paket.dependencies file in the solution root and replaces each `packages.config` with an equivalent paket.references file.
2. If there is a solution-level `packages.config`, then it will be removed and its dependencies will be included into the paket.dependencies file.
3. If you use NuGet Package Restore ([MSBuild-Integrated or Automatic Visual Studio Package Restore](http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore)), then the [`paket auto-restore`](paket-auto-restore.html) command will be invoked.
4. Next (unless `--no-install` is specified), the [paket install](paket-install.html) process with the `--hard` flag will be executed. This will:
4. Next (unless `--no-install` is specified), the [paket install](paket-install.html) process will be executed. This will:

- analyze the dependencies.
- generate a paket.lock file.
Expand Down
2 changes: 1 addition & 1 deletion docs/content/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ In case of the command's failure, you can fallback to manual approach:

1. Analyse your `packages.config` files and extract the referenced packages into a paket.dependencies file.
2. Convert each `packages.config` file to a paket.references file. This is very easy - you just have to remove all the XML and keep the package names.
3. Run [paket install](paket-install.html) with the `--hard` flag. This will analyze the dependencies, generate a paket.lock file, remove all the old package references from your project files and replace them with equivalent `Reference`s in a syntax that can be managed automatically by Paket.
3. Run [paket install](paket-install.html). This will analyze the dependencies, generate a paket.lock file, remove all the old package references from your project files and replace them with equivalent `Reference`s in a syntax that can be managed automatically by Paket.
4. (Optional) Raise corresponding issue [here](https://github.com/fsprojects/Paket/issues) so that we can make the command even better.

## How do I convert a new project to Paket when my solution is already using Paket
Expand Down
86 changes: 4 additions & 82 deletions integrationtests/Paket.IntegrationTests/BindingRedirect.fs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ let ``#1195 should report broken app.config``() =
| exn when exn.Message.Contains("Project1") && exn.Message.Contains("app.config") -> ()

[<Test>]
let ``#1218 install hard should replace all assembly redirects with required only``() =
paket "install --redirects --createnewbindingfiles --hard" "i001218-binding-redirect" |> ignore
let ``#1218 install should replace all assembly redirects with required only``() =
paket "install --redirects --createnewbindingfiles" "i001218-binding-redirect" |> ignore

let path = Path.Combine(scenarioTempPath "i001218-binding-redirect")
let config1Path = Path.Combine(path, "Project1", "app.config")
Expand Down Expand Up @@ -143,88 +143,10 @@ let ``#1218 install hard should replace all assembly redirects with required onl
config4.Contains ``xunit.extensions`` |> shouldEqual false
config4 |> shouldContainText ``Castle.Core``
config4.Contains ``Castle.Windsor`` |> shouldEqual false

[<Test>]
let ``#1218 install should replace paket's binding redirects with required only``() =
paket "install --redirects --createnewbindingfiles" "i001218-binding-redirect" |> ignore

let path = Path.Combine(scenarioTempPath "i001218-binding-redirect")
let config1Path = Path.Combine(path, "Project1", "app.config")
let config2Path = Path.Combine(path, "Project2", "app.config")
let config3Path = Path.Combine(path, "Project3", "app.config")
let config4Path = Path.Combine(path, "Project4", "app.config")

let config1 = File.ReadAllText(config1Path)
let config2 = File.ReadAllText(config2Path)
let config3 = File.ReadAllText(config3Path)
let config4 = File.ReadAllText(config4Path)

let paketMark = "<Paket>True</Paket>\s*"

let Albedo = """<assemblyIdentity name="Ploeh.Albedo" publicKeyToken="179ef6dd03497bbd" culture="neutral" />"""
let AutoFixture = """<assemblyIdentity name="Ploeh.AutoFixture" publicKeyToken="b24654c590009d4f" culture="neutral" />"""
let ``AutoFixture.Idioms`` = """<assemblyIdentity name="Ploeh.AutoFixture.Idioms" publicKeyToken="b24654c590009d4f" culture="neutral" />"""
let ``AutoFixture.Xunit`` = """<assemblyIdentity name="Ploeh.AutoFixture.Xunit" publicKeyToken="b24654c590009d4f" culture="neutral" />"""
let log4net = """<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />"""
let ``Newtonsoft.Json`` = """<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />"""
let ``Newtonsoft.Json.Schema`` = """<assemblyIdentity name="Newtonsoft.Json.Schema" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />"""
let xunit = """<assemblyIdentity name="xunit" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />"""
let ``xunit.extensions`` = """<assemblyIdentity name="xunit.extensions" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />"""
let ``Castle.Core`` = """<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" culture="neutral" />"""
let ``Castle.Windsor`` = """<assemblyIdentity name="Castle.Windsor" publicKeyToken="407dd0808d44fbdc" culture="neutral" />"""

Regex.IsMatch(config1, paketMark + Albedo) |> shouldEqual true
Regex.IsMatch(config1, paketMark + AutoFixture) |> shouldEqual true
config1.Contains ``AutoFixture.Idioms`` |> shouldEqual false
config1.Contains ``AutoFixture.Xunit`` |> shouldEqual false
config1.Contains log4net |> shouldEqual false
Regex.IsMatch(config1, paketMark + ``Newtonsoft.Json``) |> shouldEqual true
config1.Contains ``Newtonsoft.Json.Schema`` |> shouldEqual false
config1.Contains xunit |> shouldEqual false
Regex.IsMatch(config1, paketMark + ``xunit.extensions``) |> shouldEqual true
Regex.IsMatch(config1, paketMark + ``Castle.Core``) |> shouldEqual true
config1.Contains ``Castle.Windsor`` |> shouldEqual false

config2.Contains Albedo |> shouldEqual false
config2.Contains AutoFixture |> shouldEqual false
config2.Contains ``AutoFixture.Idioms`` |> shouldEqual false
config2.Contains ``AutoFixture.Xunit`` |> shouldEqual false
config2.Contains log4net |> shouldEqual false
config2 |> shouldContainText ``Newtonsoft.Json``
config2.Contains ``Newtonsoft.Json.Schema`` |> shouldEqual false
config2.Contains xunit |> shouldEqual false
config2.Contains ``xunit.extensions`` |> shouldEqual false
config2.Contains ``Castle.Core`` |> shouldEqual false
config2.Contains ``Castle.Windsor`` |> shouldEqual false

config3.Contains Albedo |> shouldEqual false
config3 |> shouldContainText AutoFixture
config3.Contains ``AutoFixture.Idioms`` |> shouldEqual false
config3.Contains ``AutoFixture.Xunit`` |> shouldEqual false
config3.Contains log4net |> shouldEqual false
Regex.IsMatch(config3, paketMark + ``Newtonsoft.Json``) |> shouldEqual true
config3.Contains ``Newtonsoft.Json.Schema`` |> shouldEqual false
config3.Contains xunit |> shouldEqual false
config3.Contains ``xunit.extensions`` |> shouldEqual false
Regex.IsMatch(config3, paketMark + ``Castle.Core``) |> shouldEqual true
config3.Contains ``Castle.Windsor`` |> shouldEqual false

config4.Contains Albedo |> shouldEqual false
config4.Contains AutoFixture |> shouldEqual false
config4.Contains ``AutoFixture.Idioms`` |> shouldEqual false
config4.Contains ``AutoFixture.Xunit`` |> shouldEqual false
config4.Contains log4net |> shouldEqual false
config4 |> shouldContainText ``Newtonsoft.Json``
config4.Contains ``Newtonsoft.Json.Schema`` |> shouldEqual false
config4.Contains xunit |> shouldEqual false
config4.Contains ``xunit.extensions`` |> shouldEqual false
Regex.IsMatch(config4, paketMark + ``Castle.Core``) |> shouldEqual true
config4.Contains ``Castle.Windsor`` |> shouldEqual false


[<Test>]
let ``#1248 install should replace paket's binding redirects with required only and keep stable``() =
paket "install --redirects --hard --createnewbindingfiles" "i001248-stable-redirect" |> ignore
paket "install --redirects --createnewbindingfiles" "i001248-stable-redirect" |> ignore

let originalConfig2Path = Path.Combine(originalScenarioPath "i001248-stable-redirect", "Project2", "app.config")

Expand Down Expand Up @@ -335,7 +257,7 @@ let ``#1477 assembly redirects lock files``() =
let scenario = "i001474-restore-no-locks"
prepare scenario
let p = Paket.Dependencies.Locate (Path.Combine(scenarioTempPath scenario, "paket.dependencies"))
p.Install(true,true)
p.Install(true)
p.Restore()

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<runtime><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Common.Logging.NLog20" publicKeyToken="af08829b84f0328e" culture="neutral" />
<assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<Paket>True</Paket>
<assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
<assemblyIdentity name="Common.Logging.NLog20" publicKeyToken="af08829b84f0328e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="2.2.0.0" />
</dependentAssembly>
<dependentAssembly>
Expand All @@ -37,5 +36,4 @@
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-999.999.999.999" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding></runtime>
</configuration>
</assemblyBinding></runtime></configuration>
13 changes: 4 additions & 9 deletions src/Paket.Core/BindingRedirects.fs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ let private addConfigFileToProject project =
project.Save(false))

/// Applies a set of binding redirects to a single configuration file.
let private applyBindingRedirects isFirstGroup cleanBindingRedirects bindingRedirects (configFilePath:string) =
let private applyBindingRedirects isFirstGroup bindingRedirects (configFilePath:string) =
let config =
try
XDocument.Load(configFilePath, LoadOptions.PreserveWhitespace)
Expand All @@ -132,17 +132,12 @@ let private applyBindingRedirects isFirstGroup cleanBindingRedirects bindingRedi
use originalContents = new StringReader(config.ToString())
let original = XDocument.Load(originalContents, LoadOptions.None).ToString()

let isMarked e =
match tryGetElement (Some bindingNs) "Paket" e with
| Some e -> String.equalsIgnoreCase (e.Value.Trim()) "true"
| None -> false

let nsManager = XmlNamespaceManager(NameTable());
nsManager.AddNamespace("bindings", bindingNs)
config.XPathSelectElements("//bindings:assemblyBinding", nsManager)
|> Seq.collect (fun e -> e.Elements(XName.Get("dependentAssembly", bindingNs)))
|> List.ofSeq
|> List.filter (fun e -> isFirstGroup && (cleanBindingRedirects || isMarked e))
|> List.filter (fun e -> isFirstGroup)
|> List.iter (fun e -> e.Remove())

let config = Seq.fold setRedirect config bindingRedirects
Expand All @@ -153,7 +148,7 @@ let private applyBindingRedirects isFirstGroup cleanBindingRedirects bindingRedi
config.Save(configFilePath, SaveOptions.DisableFormatting)

/// Applies a set of binding redirects to all .config files in a specific folder.
let applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindingRedirects rootPath bindingRedirects =
let applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles rootPath bindingRedirects =
let applyBindingRedirects projectFile =
let bindingRedirects = bindingRedirects projectFile
let path = Path.GetDirectoryName projectFile.FileName
Expand All @@ -166,7 +161,7 @@ let applyBindingRedirectsToFolder isFirstGroup createNewBindingFiles cleanBindin
addConfigFileToProject projectFile
Some config
| _ -> None
|> Option.iter (applyBindingRedirects isFirstGroup cleanBindingRedirects bindingRedirects)
|> Option.iter (applyBindingRedirects isFirstGroup bindingRedirects)

rootPath
|> getProjectFilesWithPaketReferences Directory.GetFiles
Expand Down
Loading