目录结构如下-
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
我在每个解决方案中使用以下代码引用。nuget文件夹
Project("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}") = ".nuget", ".nuget", "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx}"
ProjectSection(SolutionItems) = preProject
.......nugetNuGet.Config = .......nugetNuGet.Config
.......nugetNuGet.exe = .......nugetNuGet.exe
.......nugetNuGet.targets = .......nugetNuGet.targets
EndProjectSection
EndProject
在每个项目文件(.csproj)中,我都引用了通用的NuGet。目标使用,
<Import Project=".........nugetNuGet.targets" Condition="Exists('.........nugetNuGet.targets')" />
NuGet 。我添加了以下行,以便它应该(必须)复制EXPECTED文件夹ONLY
中的包<add key="repositoryPath" value="..packages" />
我已经用TFS映射了Projects文件夹,它要求我在两个位置添加文件,因为上面的问题
NuGet将查找NuGet。基于当前解决方案目录的配置文件。
如果项目目录在c:Projects,那么你的App1解决方案。sln文件将在c:ProjectsSourcesApplicationsApp1目录下。现在NuGet会寻找NuGet。配置目录:
c:ProjectsSourcesApplicationsApp1.nugetNuGet.Config
c:ProjectsSourcesApplicationsApp1NuGet.Config
c:ProjectsSourcesApplicationsNuGet.Config
c:ProjectsSourcesNuGet.Config
c:ProjectsNuGet.Config
c:NuGet.Config
在此之后,它会在整个机器范围内查找,但我现在将忽略这些
查看项目的目录结构。nuget不会检查nuget目录。不是任何解决方案目录的父目录。
我会考虑放入NuGet。配置文件,将repositoryPath设置在Sources目录或Projects目录(而不是.nuget目录)中。或者有两个NuGet。配置文件,一个在App1。nuget目录和App2. nuget目录中的一个。nuget目录。