Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there way to force FAKE RestorePackages() to look for packages to restore in other path than "./**/packages.config"?

Let's say I have a following folder structure

build
    build.fsx
    build.bat
    //build tools etc.
src
    Project1
    Project2
    //...

When I run my RestorePackages() in build.fsx it will look for packages.config in "./**/packages.config" (according to documentation), and will ignore all packages to be restored in project folders.

I can use this method and probably give path one-by-one to every project's packages.config, but I don't want to change build script every time I add new project to solution.

Is there a way, to make RestorePackages() to look for all packages.config in some specific path?

EDITED:

Additional, related question. I see, I'll have to pass nuget path to RestorePackage, because by default it seems to expect it in ./tools/nuget/nuget.exe. I can do this probably like that:

RestorePackage(fun p -> { p with ToolPath = "my/nuget/path"})

But I have no idea how to tie it into example you provided. F# syntax is still a little bit confusing for me around pipes and function calls.

like image 696
mlusiak Avatar asked Jul 22 '14 11:07

mlusiak


1 Answers

I see two solutions.

  1. put your build script into the project root
  2. Overwrite the default method. Put this to the top of your build script:
let RestorePackages() = 
    !! "./../**/packages.config"
    |> Seq.iter (RestorePackage id)
like image 52
forki23 Avatar answered Sep 28 '22 01:09

forki23