Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget: How do I recreate my package directory using packages.config

Tags:

c#

nuget

I have installed StructureMap using Nuget.

I do not want to checkin the created packages directory.

How do I recreate my package directory using packages.config?

I tried Update-Package with no success (nothing happended, I only get a little delay for the first time).

My packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="structuremap" version="2.6.3" />
</packages>
like image 463
Rookian Avatar asked Dec 22 '22 08:12

Rookian


2 Answers

See this article on the NuGet website: Using NuGet without committing packages to source control.

The article shows how to setup NuGet to restore all required packages for a solution. This NuGet feature is called "NuGet Package Restore".

like image 82
cadrell0 Avatar answered Dec 24 '22 02:12

cadrell0


I know you've approved an answer but I thought I'd share what I did.

In VS2010 I went to Tool->Library Package Manager > Package Manager Console in the Console I typed this command

PM> Install-Package NuGetPowerTools

Then I typed this

PM> Enable-PackageRestore

This put a folder called .nuget at the top level of my solution

In that folder I created a file called restore.bat with this as the content

cd ..
for /f "tokens=* delims=" %%i in ('dir /s /b packages.config') do (
.nuget\nuget.exe install -o packages "%%i"
)
cd .nuget

running the bat file will do a full reinstall of all the stuff in your package files

To finish off the job I made a solution folder in my project called .nuget and included the bat file and other junk that was in there just so another developer getting my project doesn't have to think too hard.

like image 45
Peter Avatar answered Dec 24 '22 00:12

Peter