init.ps1 does not run externally?

Jun 10, 2011 at 8: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.




Jun 10, 2011 at 1:40 PM

Ps1 scripts are never run from outside VS mostly because they depend on DTE ( Take a look at PSGet

Jun 11, 2011 at 9: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 ?