times when init.ps1 runs

Oct 23, 2011 at 12:00 AM

I've added some codesnippet file deployment steps to my install.ps1 and also to a init.ps1.

the reason for including the init.ps1 code file deployment steps is that in a prior thread it was noted that init.ps1 runs when you open a solution containing nuget packages and so this would cover deployment of the package provided codesnippet file(s) on dev/test wks where they are using a solution that has the packages already in place.

q1 - if i have the codesnippet file deployment steps in my init.ps1 is having them also in my install.ps1 creating a duplication, e.g. when someone installs or updates the nuget package is install.ps1 first running those code snippet steps and then init.ps1 runs them again or does init.ps1 only run on a machine where you open a solution containing the packages already defined/installed?

q2 - a separate thread on this forum suggested that init.ps1 doesn't run when someone uses the "nuget.exe install <package> -o <sln packages path>" command, just wanted to confirm that is the case and whether or not install.ps1 still runs in those cases?

Oct 23, 2011 at 2:07 AM

q1- Whatever you have in the init.ps1 will run whenever you load the solution and the package manager console.

If you have the same code in install.ps1, it will run that as well during install. It does not detect whether it is the same code or not.

q2 - When you run nuget.exe, it will download and unpack nupkgs. This is pretty much all it does. It does not know about visual studio at all and thus cannot perform any referencing activities or running any powershell.

Hope this helps.

"Be passionate in all you do"