Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet Package Restore in Jenkins Build using SVN

I've tried following the documentation with no luck.
http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages http://docs.nuget.org/docs/reference/package-restore

I do not want to commit my packages folder to SVN and I am trying to get the package restore to fire in Jenkins but am unsure how to do so. Everything works fine locally within visual studio. How do I get this to work with my Jenkins build? I am getting ResolveAssemblyReferences errors. Could not locate assembly.

I don't want to use MSBuild-Integrated Package Restore if possible. I do not want to add .Nuget folder to SVN.

is it possible for Jenkins to use Automatic Package Restore? Or do I have to use Command-Line Package Restore? https://docs.nuget.org/docs/reference/package-restore

What special settings do I need set in Jenkins?

P.S. I have the jenkins plugin installed and I am using MS VS 2010.

like image 813
PsychoDUCK Avatar asked Apr 07 '14 15:04

PsychoDUCK


People also ask

How do you restore NuGet packages?

You can restore packages manually with nuget restore , dotnet restore , msbuild -t:restore , or through Visual Studio. The dotnet build and dotnet run commands automatically restore packages, and you can configure Visual Studio to restore packages automatically when it builds a project.

How do I force a NuGet package to reinstall?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

How do I fix NuGet recovery failed?

Quick solution for Visual Studio usersSelect the Tools > NuGet Package Manager > Package Manager Settings menu command. Set both options under Package Restore. Select OK. Build your project again.

Does dotnet restore NuGet packages?

Description. The dotnet restore command uses NuGet to restore dependencies as well as project-specific tools that are specified in the project file.


1 Answers

Anything you can do on the command line, you can do in Jenkins. In Jenkins, you can specify multiple build steps (see the Add build step button). To do a package-restore from the command line just as you can do from your own box. Select Execute Windows Batch command from the drop down menu. You can reorder build steps when you have more than one. There's a tiny handle next to the build step's description (i.e. where it says Execute Windows batch command above the field where you can specify the Windows commands).

However, in reading the latest documentation, You can do package-restore inside your Solution file. This would be preferable. Also, use your version control's ignore option to ignore the folder where you download these packages. This way, no one will accidentally check in the downloaded packages into version control.

Under the Jenkins Source Code Management Section, use either "Emulate a clean checkout by first deleting unversioned/ignored files, then 'svn update'", or if that doesn't work "Always checkout a clean copy" under Source Code Management. I find that VisualStudio plants stuff all over the place when you do a build, and that can interfere when you try a rebuild.

like image 200
David W. Avatar answered Sep 19 '22 09:09

David W.