Created
August 14, 2012 20:46
-
-
Save nrolland/3352821 to your computer and use it in GitHub Desktop.
Install your packages for a solution from its project's packages.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if INTERACTIVE | |
#r "System.Xml" | |
#r "System.Xml.Linq" | |
#endif | |
open System | |
open System.IO | |
open System.Xml.Linq | |
open System.Text.RegularExpressions | |
let rec findsolutiondir (p:DirectoryInfo) = | |
if (p.GetFiles("*.sln") |> Array.length > 0) | |
then p | |
else findsolutiondir p.Parent | |
let root = findsolutiondir (DirectoryInfo(__SOURCE_DIRECTORY__)) | |
let getprojectsdir (root:DirectoryInfo) = | |
let rec getdirs (root:DirectoryInfo) = seq { | |
yield! root.GetDirectories() |> Array.filter(fun f -> f.GetFiles("*.fsproj") |> Array.length > 0 ) | |
yield! root.GetDirectories() |> Array.map(fun d -> getdirs d) |> Seq.concat} | |
getdirs root | |
getprojectsdir root |> Seq.iter (fun d -> let p = new System.Diagnostics.Process(); | |
printfn "installing %A"d.Name | |
p.StartInfo.WorkingDirectory <- root.FullName | |
p.StartInfo.FileName <- "powershell.exe"; | |
p.StartInfo.Arguments <- ("/c nuget i " + d.Name + "\\packages.config -o Packages") | |
p.StartInfo.RedirectStandardOutput <- true | |
p.StartInfo.UseShellExecute <- false | |
p.Start() | |
printfn "result ?" | |
printfn "result %A" (p.StandardOutput.ReadToEnd()) | |
printfn "done" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment