update-package doesnt execute install.ps1 in all projects when there is more than one project

Jun 20, 2011 at 3:22 PM
Edited Jun 20, 2011 at 3:22 PM

Here is how to reproduce this. let me know if it is the expected behavior instead of bug and how we could solve it incase it is not a bug.

1. Create a new solution and add a console app ("consoleapplication1").

2. then install an older version of the "Facebook" nuget package.

 Install-Package Facebook -version 5.0.35.0

notice that it removes the reference "Facebook.Contract.dll". This is due to the script in install.ps1

3. then add new console app to the same solution ("consoleapplication2")

 Install-Package Facebook -version 5.0.35.0

till here it works fine. so both the projects doesnt contain the facebook.contracts.dll file.

4. then still selecting "consoleapplication2" in the package manager console

Update-Package Facebook

It updates both the consoleapplication1 and consoleapplication2 to the latest version v5.0.40 but runs the install.ps1 only for "consoleapplication2" project as it was the defuault selected project in the drop down.

So what happens now is.

consoleapplication2 doesnt contain the "Facebook.Contracts.dll" which is great. but then it forgets to remove the "Facebook.Contracts.dll" from consoleapplication1 project. i suspect this is due to the fact that install.ps1 gets executed only once and not to all the projects that gets updated.


Jun 20, 2011 at 4:04 PM
Is this on the latest 1.4 that was just released Friday? It sounds like it is due to using the update-package across projects.

If not, and you are using the nuget package updater (which is now deprecated), please upgrade to 1.4, remove the package updater package and try this again.


On Mon, Jun 20, 2011 at 9:22 AM, prabirshrestha <notifications@codeplex.com> wrote:

From: prabirshrestha

Here is how to reproduce this. let me know if it is the expected behavior instead of bug and how we could solve it incase it is not a bug.

1. Create a new solution and add a console app ("consoleapplication1").

2. then install an older version of the "Facebook" nuget package.

Install-Package Facebook -version 5.0.35.0

notice that it removes the reference "Facebook.Contract.dll". This is due to the script in install.ps1

3. then add new console app to the same solution ("consoleapplication2")

Install-Package Facebook -version 5.0.35.0

till here it works fine. so both the projects doesnt contain the facebook.contracts.dll file.

4. then still selecting "consoleapplication2" in the package manager console

Update-Package Facebook

It updates both the consoleapplication1 and consoleapplication2 to the latest version v5.0.40 but runs the install.ps1 only for "consoleapplication2" project as it was the defuault selected project in the drop down.

So what happens now is.

consoleapplication2 doesnt contain the "Facebook.Contracts.dll" which is great. but then it forgets to remove the "Facebook.Contracts.dll" from consoleapplication1 project. i suspect this is due to the fact that install.ps1 gets executed only once and not to all the projects that gets updated.

It becomes pretty annnony to then go to the other projects and remove the Facebook.contracts.dll from the rest of the projects.



Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jun 20, 2011 at 4:13 PM

i tested it on v1.4 which was just released.

prior to it there was no way to update the package in multiple projects at the same time.

my nuget.exe and nuget pacakge manager are both v1.4.

could you reproduce the problem?

thanks.

prabir

Jun 20, 2011 at 4:17 PM
Well actually there was a way - http://nuget.org/list/packages/nugetpackageupdater

That's why I asked (to be sure this was with the new release). So what you are seeing is that the install.ps1 (and probably uninstall.ps1) is not applied to each project where the package is found to update?

This does seem like a bug. I have not yet attempted to repro it.


On Mon, Jun 20, 2011 at 10:13 AM, prabirshrestha <notifications@codeplex.com> wrote:

From: prabirshrestha

i tested it on v1.4 which was just released.

prior to it there was no way to update the package in multiple projects at the same time.

my nuget.exe and nuget pacakge manager are both v1.4.

could you reproduce the problem?

thanks.

prabir

Read the full discussion online.

To add a post to this discussion, reply to this email (nuget@discussions.codeplex.com)

To start a new discussion for this project, email nuget@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Jun 20, 2011 at 4:33 PM

i havent installed NuGetPackageUpdater.

so most likely it is a bug in v1.4

i'm not sure about the uninstall.ps1 as we don't use it, but what i can tell for sure is that install.ps1 doesnt get executed for all projects. It gets executed only for the default project selected in the nuget package manager console.

Jun 20, 2011 at 6:55 PM
I am not sure if it is by design, but here is a reproduction of your issue.

Here is the project for reproduction: http://dl.dropbox.com/u/9391884/NuGetPackageUpdateTests.zip

All you need to do is open the project, open the package manager console and call .\ReproduceUpdateIssue.ps1

PM> .\ReproduceUpdateIssue.ps1
Successfully installed 'nugetpackageupdatetest 1.0'.
===================================================
init.ps1 was called
===================================================
Successfully added 'nugetpackageupdatetest 1.0' to NuGetPackageUpdateTests.
===================================================
install.ps1 was called for project NuGetPackageUpdateTests
===================================================
 
'nugetpackageupdatetest 1.0' already installed.
Successfully added 'nugetpackageupdatetest 1.0' to NuGetPackageUpdateTestsLib.
===================================================
install.ps1 was called for project NuGetPackageUpdateTestsLib
===================================================
 
Updating 'nugetpackageupdatetest' from version '1.0' to '2.0' in project 'NuGetPackageUpdateTestsLib'.
Successfully removed 'nugetpackageupdatetest 1.0' from NuGetPackageUpdateTestsLib.
Successfully installed 'nugetpackageupdatetest 2.0'.
===================================================
init.ps1 was called
===================================================
Successfully added 'nugetpackageupdatetest 2.0' to NuGetPackageUpdateTestsLib.
Updating 'nugetpackageupdatetest' from version '1.0' to '2.0' in project 'NuGetPackageUpdateTests'.
===================================================
uninstall.ps1 was called for project NuGetPackageUpdateTests
===================================================
Successfully removed 'nugetpackageupdatetest 1.0' from NuGetPackageUpdateTests.
Successfully added 'nugetpackageupdatetest 2.0' to NuGetPackageUpdateTests.
===================================================
install.ps1 was called for project NuGetPackageUpdateTests
===================================================
Successfully uninstalled 'nugetpackageupdatetest 1.0'.

Neither install.ps1 or uninstall.ps1 were called on the other project and IMHO probably should have been.

____
Rob
"Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds
http://ferventcoder.com
http://twitter.com/ferventcoder
Jun 20, 2011 at 6:56 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 20, 2011 at 6:59 PM

Thanks Rob! Doesn't sound like it's by design...

Developer
Jun 20, 2011 at 7:03 PM

It's a bug :)