简体   繁体   English

NuGet软件包还原问题

[英]NuGet Package Restore Issue

I need NuGet to automatically restore packages. 我需要NuGet自动还原软件包。 At the moment, the referenced dlls are missing. 目前,所引用的dll丢失了。

I have enabled package restore on my solution. 我已在解决方案上启用package restore

The .nuget folder is checked in. .nuget文件夹已签入。

The packages.config file is checked in for each project. 已为每个项目检入packages.config文件。

The packages folder (on solution level) is check in. packages文件夹(在解决方案级别)已签入。

The packages folder contains folders for all the packages the solution uses with nuspec and nupkg files for each package. packages文件夹包含该解决方案使用的所有packages文件夹,以及每个软件包的nuspecnupkg文件。 The dll is not checked in. dll未签入。

In VisualStudio the packages are installed but the reference to the dll in each project is missing (ass the dll is not checked in). VisualStudio ,安装了软件包,但是缺少对每个项目中dll的引用(假定未检入dll)。

I have tried to install NuGetPowerTools . 我试图安装NuGetPowerTools Same story. 相同的故事。

Thanks, 谢谢,

There is no reason to check-in anything underneath the packages folder. 没有理由在packages文件夹下签入任何东西。 Optionally, you can check in the repositories.config file but technically this is not required. (可选)您可以签入repositories.config文件,但从技术上讲,这不是必需的。

Do I get it right that you have checked-in the nuspec and nupkg files within the Packages folder? 我是否已经检查了Packages文件夹中的nuspec和nupkg文件,对吗? if so, delete them. 如果是这样,请将其删除。 These will be restored, and their presence might be causing restore failures (I don't think NuGet package restore is checking for the presence of the package contents, and rather checks for the presence of the nupkg/nuspec file in the Packages folder, skipping the package from being restored if found) 这些将被还原,并且它们的存在可能会导致还原失败(我不认为NuGet软件包还原正在检查软件包内容的存在,而是在Packages文件夹中检查nupkg / nuspec文件的存在,跳过了如果找到,则无法还原该包)

In summary, check in only: 总之,仅签入:

  1. The empty solution level packages folder (optionally the repositories.config ) 空的解决方案级别packages文件夹(可选的是repositories.config
  2. .nuget folder and its contents .nuget文件夹及其内容
  3. packages.config for every project 每个项目的packages.config

I have got this problem in Visual Studio 2015 Update 3. 我在Visual Studio 2015更新3中遇到此问题。

Found a solution that worked for me: 找到了一个对我有用的解决方案

Went in to the user profile NuGet cache ( C:\\Users\\<username>\\.nuget\\packages\\ ), and deleted everything in there. 进入用户配置文件NuGet缓存( C:\\Users\\<username>\\.nuget\\packages\\ ),并删除其中的所有内容。

I think during the restore process my cache was cleared of all DLL files, and when I tried to install a package it was using the cache instead of the files off of NuGet. 我认为在还原过程中,我的缓存被清除了所有DLL文件,当我尝试安装软件包时,它使用的是缓存而不是NuGet中的文件。 Now that I've cleared the cache, I can now install the NuGet packages. 现在,我已经清除了缓存,现在可以安装NuGet软件包了。

This is almost the same symptoms as I had once, and then the cause was the permission level on packages.config . 这几乎与我以前的症状相同,然后原因是packages.config的权限级别。 Deleting the file solved it for me. 删除文件为我解决了。

I have no idea if it will help you, but have a look at the permission sets for all the files. 我不知道它是否会对您有所帮助,但请看一下所有文件的权限集。

Same here, deleted config and re-referenced all the packages. 同样,删除配置并重新引用所有软件包。 Think it has something to do with SVN. 认为它与SVN有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM