Automatizing Packages Install and Update

Jul 3, 2011 at 7:11 PM

Hello,

I have a solution with 4 projects ... Each project needs 8 to 12 packages. Some are common some are not.

I don't want to write in the Package Manage Console application the install command for each of these packages.

I would like to find a way to automatize the install and also the update.

I wasn't able to find a solution for this problem ... I believe this problem would be quite common.

I see a few solutions, even if I am not sure how to to that:

1 - Create a Test Method in my test project that contains the following:    

     public void InstallPackages() {
        var powerShell = PowerShell.Create();
        powerShell.AddCommand("Install-Package EntityFramework");
        powerShell.AddCommand("Agatha-rrsl");
        powerShell.Invoke();
    }
  

 

     I would have a similar script for update ...

     But using a test for this looks strange and I am not sure if this works.

2 - Create some kind of script that when called would install the correct packages for each project ...

      Is this possible?

Could someone advice me on this?

Most info I found is about creating and publishing packages and not about automatizing packages install and update.

Thank You,

Miguel

 

Jul 3, 2011 at 8:02 PM

Not sure what you are trying to solve here. Are you trying to write something to automate something you do once and them update only very few times (call update-package with no parameters)?

If you are just trying to speed up the process, you can install a package into multiple projects with the gui if you right click on solution instead of a project.

On the console I'm not sure if the feature is in to allow multiple projects with a ; between them or not. If it is you do something to the effect of
"install-package foo -project vs1;vs2"

Are you talking about releasing software that needs to download nuget packages?

Are you talking about not checking packages in and the other devs need to download those packages? Nuget command line already handles this.
"nuget install packages.config"

If it is something different, you may want to look at chewie and/or chocolatey to see if they meet what you are trying to do (chewie might be closer to what it sounded like you wanted than chocolatey).
____
Rob
"Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds
http://ferventcoder.com
http://twitter.com/ferventcoder

Jul 3, 2011 at 8:24 PM

Hello,

When I start a solution I usually have 4 projects and each one needs 8 to 12 packages. This takes me some time ...

I would like to have a script which I could use to install all this packages. I was thinking on something like this:

function InstallPackages {

    
    Install-Package EntityFramework -ProjectName $Proj1
    Install-Package SqlServerCompact -ProjectName $Proj1

    Install-Package EntityFramework -ProjectName $Proj2
    Install-Package Agatha-rssl -ProjectName $Proj2

    Install-Package SqlServerCompact -ProjectName $Proj3

}

function Install-PackagesForAllProjects {

    foreach ($project in Get-Project -all) {
      Install-Package elmah -ProjectName $projectName
    }

}

Then I would call this functions to install all packages. I could use file in all solutions ... Does this make sense?

1 - But how to "register" this script?

2 - And how to update the packages when needed?

Thank You,

Miguel