Diagnosing an "install" issue that gives no feedback

Topics: Ecosystem
Aug 13, 2012 at 10:23 PM

I have created a powershell script which installs all the packages from a packages.config file.  Seems to work great when run from the powershell prompt.  When executing it from Jenkins it does not install any packages....but it seems to give no error (return code) or output explaining any sort of problem.

I'm struggling to diagnose this as the core concepts seems to be working but just not in conjunction with other tools.

When I check the $LastExitCode in the PS script it says 0.

Here is a snippet of the script.

$solutionPath | Get-ChildItem -r -filter "packages.config" | ForEach-Object {
   $filename = $_.Directory.ToString() + '\' + $_.Name 
   & 'NuGet.exe' install $filename  -Source http://localhost/NuGetServer/nuget -OutputDirectory .\packages -ExcludeVersion
          
   $LastExitCode

}          

When run from the prompt I get good feedback and it installs the packages.

When run from the Jenkins job I get only a "0" for the $LastExitCode

I realize my facts are limited here, I'm not really looking for an answer as must as just looking for some input as to some additional troubling shooting tips.

Aug 14, 2012 at 2:02 AM

More information....

I simplified down to calling a single simple command.  One case works and another does not.  These are being called from Jenkins using a standard windows batch file plugin.  Both cases work fine if run outside of Jenkins from a plain old cmd.exe window.

 

Works case:

powershell.exe -Command "& NuGet.exe install Platform1.OutputLibraryInterface -Version 1.0.12226.34  -Source http://localhost/NuGetServer/nuget/ -OutputDirectory .\packages -ExcludeVersion"

Does not work case:

powershell.exe -Command "& NuGet.exe install .\AddOnOutputLibrary\packages.config  -Source http://localhost/NuGetServer/nuget/ -OutputDirectory .\packages -ExcludeVersion"

Aug 14, 2012 at 2:11 AM

Further simplifying, take powershell out of the mix and  go directly from the Jenkins batch plugin to NuGet.exe

Works case:

NuGet.exe install Platform1.OutputLibraryInterface -Version 1.0.12226.34  -Source http://localhost/NuGetServer/nuget/ -OutputDirectory .\packages -ExcludeVersion

Does not work case:

NuGet.exe install .\AddOnOutputLibrary\packages.config  -Source http://localhost/NuGetServer/nuget/ -OutputDirectory .\packages -ExcludeVersion

Aug 14, 2012 at 3:16 AM

Found it.

Looks like to get an "install" using a packages.config to function you need to have the restore setting in you NuGet.config....

  <packageRestore>
    <add key="enabled" value="True" />
  </packageRestore>

I had this for my interactive user in:

C:\Users\Administrator\AppData\Roaming\NuGet\NuGet.Config

But not in the one for the Jenkins service user:

C:\Windows\System32\config\systemprofile\AppData\Roaming\NuGet

 

So first question is what is the right way to get the non-interactive users settings for this setup?

Second question is, could we get NuGet to provide some feedback that the install is being ignored due to the setting being false?

Developer
Aug 17, 2012 at 4:54 PM

@jlongio, the missing error message was a bug that we fixed recently. I'll work on getting the update available soonish. We also addressed the scenario for requiring consent to perform restore in the latest update that we pushed to the gallery (run nuget.exe update -self). This should solve your first issue.