Usare path custom con NuGet

Leggere attentamente le avvertenze, usare con cautela: questo post utilizza una feature non documentata di NuGet, ergo… It works on my machine <g>

Dal rilascio della versione 1.1, per i miei spike ho iniziato ad utilizzare NuGet, un interessante package manager per Visual Studio; per intenderci, è un add-in che “infila” un prompt Powershell nell’IDE e permette di aggiungere comodamente delle reference al progetto aperto. Per esempio: volete provare le “gioie” di Entity Framework 4.1 (a.k.a. Code First)? Aprite/create il progetto “cavia” con VS, e nel prompt della shell di NuGet digitiamo:

Install-Package EntityFramework

Ciò fatto, NuGet scaricherà i package dal suo repository online, li “piazzerà” in un folder chiamato packages all’interno della solution e li referenzierà. Tutto perfetto, se non fosse che in bottega tutti i progetti hanno sul file-system una struttura del tipo:

filesystem

Chiaramente, io vorrei che NuGet “piazzasse” invece i package nel folder “lib”; per ottenere ciò, è sufficiente creare nel folder della solution un file xml avente nome “nuget.config” e contenente:

<settings>
  <repositoryPath>../lib/</repositoryPath>
</settings>

HTH

UPDATE: Etttepareva che non rilasciassero proprio oggi la versione 1.2 di NuGet <g> In ogni caso, il succitato hack funziona ancora… Phew!

posted @ mercoledì 30 marzo 2011 20:20

Print

Comments on this entry:

# re: Usare path custom con NuGet

Left by raffaeu at 20/10/2011 18:36
Gravatar
Funziona benone anche a livello di solution.
Grazie!

Your comment:



 (will not be displayed)


 
 
Please add 4 and 5 and type the answer here:
 

Live Comment Preview:

 
«aprile»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011