Restoring Nuget missing packages on bamboo

leo_orlandini NA November 18, 2014

Hi, 

I'm trying to setup bamboo for an existing solution in order to automize deploy.

Im using Nuget and the dll handled by nuget are not committed in bitbucket.

Is there any chance for automizing restore missing packages in bamboo?

I find only that url talking about this: https://gist.github.com/sirkirby/045e4131a04f345293d3 but i cannot figure where I have to place that kind of command.

regards

leo

2 answers

0 votes
Martin Morin July 13, 2016

You need to have on the server the nuget.exe and nuget.config to use.

Here is the code I use to have it work with a visual studio solution.

 

This is using power shell, (latest version available)

{code}

function RestoreNuget($param)

{

    $processStartInfo = new-object System.Diagnostics.ProcessStartInfo;

    $processStartInfo.Filename = "$pwd\nuget.exe";

    $processStartInfo.Arguments = "restore $param";

    $processStartInfo.RedirectStandardOutput = $True;

    $processStartInfo.RedirectStandardError = $True;

    $processStartInfo.UseShellExecute = $False;

 

    $process = New-Object System.Diagnostics.Process;

    $process.StartInfo = $processStartInfo;

    $process.start() | Out-Null;

    Write-Host $process.StandardOutput.ReadToEnd();

 

    $process.WaitForExit();

 

    if($process.ExitCode -ne 0)

    {

       Write-Host "Error :"$process.StandardError.ReadToEnd();

       throw "nuget Error";

       return $False

    }

 

    return $True;

}

 

RestoreNuget $pwd\src\YouSolution.sln;

{code}

 

You will need to set the paths properly but the above code has been working for a few months on our server.

 

 

0 votes
Martin Morin March 23, 2015

In your Bamboo plan, go in your jobs and add a new script task or command task to run once you have checkout your source code.

In that script add the information mentioned in the link you provided. Do not forget to update the file paths to match your development context.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events