本文介绍了Nuget 包在那里,但缺少参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TFS 中分支后,VS2015 Update 2 缺少对所有 Nuget 包的引用.包还原说packages.config 中列出的所有包都已安装."

After branching in TFS, VS2015 Update 2 has missing references to all Nuget packages. Package restore says "All packages listed in packages.config are already installed."

我可以手动添加对 \packages 文件夹中所有包的引用,但为什么 VS 还没有在那里检查?

I could manually add references to all of the packages in the \packages folder but why isn't VS already checking there?

推荐答案

您需要在包管理器控制台中使用 NuGet 命令行:

You need use the NuGet command line in the Package Manager Console:

Update-Package -reinstall

强制将包引用重新安装到项目中.

to force reinstall the package references into project.

NuGet 还原仅还原包目录(\packages 文件夹)中的文件,但不会还原项目中的文件或以其他方式修改项目.例如,如果某个包在您的项目中添加了一些引用 DLL 或其他文件,如果您删除其中任何一个文件,则在还原该包时将不会重新添加这些文件.这可能会导致您的项目在构建时无法找到缺失的依赖项.

NuGet Restore only restores files in the packages directory (\packages folder ), but does not restore files inside your project or otherwise modify your project.For example, if a package has added some reference DLLs or other files in your project, if you delete any of these files, they will not be re-added when restoring this package. This may cause the your project to not be able to find the missing dependencies when building.

因此使用Update-Package -reinstall"命令强制将包引用和内容文件重新安装到项目中.

So use the "Update-Package -reinstall" command to force reinstall the package references and content files into project.

这篇关于Nuget 包在那里,但缺少参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-10 23:11