init.ps1 does not run externally?

Jun 10, 2011 at 7:05 AM

Hello there Everyone,

I'm testing publishing powershell modules using Nuget. Nuget neatly creates a folder for my package and downloads the powershell module appropriately. It would be great if I could also add the newly created folder to my $env:PSModulePath.  I tried to do this using init.ps1. I noticed that init.ps1 only runs when the package is installed from within Visual Studio and not while using nuget.exe? Is this behaviour correct? If so, does anyone have any other advise? I tried searching for similar info in the discussions and I apologize if this questions has already been answered.

Ameer.

 

 

Developer
Jun 10, 2011 at 12:40 PM

Ps1 scripts are never run from outside VS mostly because they depend on DTE (http://msdn.microsoft.com/en-us/library/envdte.dte(VS.80).aspx). Take a look at PSGet 

http://vibrantcode.com/blog/2011/2/16/psget-v02now-with-more-awesome-and-fewer-version-numbers.html

Jun 11, 2011 at 8:34 AM

Thanks dfowler. It's an interesting solution and I need to spend some more time playing with it. I'm curious what yours/anyone else's thoughts are on using a Nuget based solution for distributing Powershell? I like it and apparently Andrew Nurse like it too. Anyone else? Pros/Cons ?