Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Command-line install is not launching Install/Init scripts

I was trying to use Nuget as a software deployment system (repository, versioning and delivery) - idea from Octopus. Previously I was packaging ASP.NET sites into a self-extracting RAR archives with a .CMD startup scripts embeded. Now I'm trying to use Nuget creating puckages during automated build. The issue is that the package installation scripts (tools\Install.ps1 or tools\Init.ps1) do not execute if the package is being installed using command line:

nuget.exe install <package_id> -OutputDirectory <install_folder> -source <local_repo>

Same scripts are able to execute when package installed from Visual Studio Package Manager or Console.

I do not see why this shouldn't be possible given omnipresence of PowerShell.

Am I missing something or this is behaviour by design? Will appreciate you help.

Yes, we did consider MSDeploy but we already have install scripts that do the same thing and give more control and we need some strong package management and repository for build artifacts (something that Java folks do with Maven).

like image 407
uralrocks Avatar asked Jan 17 '13 03:01

uralrocks


People also ask

What is init ps1?

Init.ps1 runs the first time a package is installed in a solution.... The script also runs every time the solution is opened. So inside Init.

How do you check Nuget is installed or not?

In Visual Studio, use the Help > About Microsoft Visual Studio command and look at the version displayed next to NuGet Package Manager. Alternatively, launch the Package Manager Console (Tools > NuGet Package Manager > Package Manager Console) and enter $host to see information about NuGet including the version.

Where does the Nuget command run?

You can use NuGet PowerShell commands to find, install, uninstall, and update NuGet packages. To open the console in Visual Studio, go to the main menu and select Tools > NuGet Package Manager > Package Manager Console command.


1 Answers

As of today, the powershell scripts are not invoked from doing installations from command line. One reason for this is that, in general, most of the install/init actions are tied to dte and the visual studio project and doesn't add much value to be able to run it from outside VS.

We have a backlog item for enabling support for exe based scripts too in addition to powershell.

like image 107
bhuvak MSFT Avatar answered Oct 12 '22 15:10

bhuvak MSFT