2015-08-12 41 views
5

Ben Dizin Yapısı gibi var -Neden NuGet Paket yöneticisi Birden Fazla Konumda Paketleri İndir/Kopyala?

Projects 
    .nuget 
     NuGet.exe 
     NuGet.config 
     NuGet.targets 
     **packages (I want to download package for different solution HERE ONLY)** 
    Sources 
     Applications 
     App1 
      App1.sln (Solution File) 
      **packages (NuGet downloads packages here first then copies to expected folder, WHY??)** 
      App1 (Porject Directory) 
       App1.csproj 
     App2 
      App2.sln (Solution File) 
      **packages (NuGet downloads packages here first then copies to expected folder, WHY??)** 
      App2 (Porject Directory) 
       App2.csproj 

Her proje dosyası (.Csproj) aşağıdaki kodu

Project("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}") = ".nuget", ".nuget", "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}" 
    ProjectSection(SolutionItems) = preProject 
     ..\..\..\.nuget\NuGet.Config = ..\..\..\.nuget\NuGet.Config 
     ..\..\..\.nuget\NuGet.exe = ..\..\..\.nuget\NuGet.exe 
     ..\..\..\.nuget\NuGet.targets = ..\..\..\.nuget\NuGet.targets 
    EndProjectSection 
EndProject 

kullanılarak her çözümde klasörü .nuget başvurulan ettim, ortak NuGet.targets başvurulan adres o BEKLENEN klasörde paketleri kopyalamak (olmalıdır) olmalıdır, böylece

<Import Project="..\..\..\..\.nuget\NuGet.targets" Condition="Exists('..\..\..\..\.nuget\NuGet.targets')" /> 

NuGet.config, ben aşağıdaki satırı ekledikten kullanarak SADECE

<add key="repositoryPath" value="..\packages" /> 

Ben Projeler TFS ile klasörü eşleştirilmiş ve bu beni çünkü yukarıdaki sorunun iki konumda dosyaları eklemek ister

cevap

0

Nuget geçerli çözümün dizinde dayalı NuGet.config file arayacaktır.

Uygulama dizini c: \ Projects içinde ise App1 çözümünüzü aldığınızda, App1.sln dosyanız c: \ Projects \ Sources \ Applications \ App1 dizininde olacaktır. o zaman makinenin geniş yerlerde arar Bundan sonra

c:\Projects\Sources\Applications\App1\.nuget\NuGet.Config 
c:\Projects\Sources\Applications\App1\NuGet.Config 
c:\Projects\Sources\Applications\NuGet.Config 
c:\Projects\Sources\NuGet.Config 
c:\Projects\NuGet.Config 
c:\NuGet.Config 

ama şimdilik bunları göz ardı edecek: Artık Nuget içinde NuGet.config dizininde arar.

Dizin yapınıza bakıldığında Projects.nuget dizini, NuGet tarafından denetlenmeyecektir. Çözüm dizinlerinden herhangi birinin ebeveyni değildir.

Kaynak dizininde veya Projeler dizininde (.nuget dizininde değil) repositoryPath ayarıyla bir NuGet.Config dosyası koymaya bakardım. Ya da iki NuGet.Config dosyası, bir App1.nuget dizininde ve bir App2.nuget dizininde sahip olmak.