从git签出后缺少nuget dll [英] nuget dlls missing after check-outing from git

查看:244
本文介绍了从git签出后缺少nuget dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含不同项目的C#解决方案.在这些项目上,我有一些普通的nuget包,例如Newtonsoft.Json,EntityFramework等.但是,当我在另一台计算机上签出我的源代码并进行构建时,它不会复制Dlls

I have a C# solution containing different projects. On those projects, I have some normal nuget packages like Newtonsoft.Json, EntityFramework , etc. But when I checkout my source on another machine, and build it, it won't copy the Dlls

我已经将整个解决方案文件夹提交给git,并且可以在Bitbucket中看到package文件夹和内容.我做错什么了?

I've committed the whole solution folder to git and I can see the package folder and the contents in Bitbucket. What did I do wrong?

P.S:我知道我可以在下面奔跑来恢复我的包裹,但这是一个很大的痛苦. PSS:我已经搜索并看到了.我正在寻找一种防止再次发生的方法

P.S: I know that I can run below to restore my packages, but that is a big pain. P.S.S: I've searched and saw this and this. I am looking for a way to prevent it from happening again

nuget install packages.config

推荐答案

使用NuGet的惯用方式(例如,与npm不同,在典型情况下,它会提交node_packages)是仅提交您的packages.config. Visual Studio将在packages/文件夹中检测到丢失的软件包,并在构建时将其还原,而在命令行中的nuget restore将执行相同的操作.

The idiomatic way to use NuGet (unlike npm, for example, where it's typical to commit node_packages) is to commit only your packages.config. Visual Studio will detect missing packages in the packages/ folder and restore them on build, and nuget restore at the command line will do the same.

这样做的原因是二进制文件比文本文件大,并且不可扩散(即无法存储增量).我不确定git甚至不会像svn那样工作,但是nuget的作者并不仅仅是为使用git的人编写.

The reason for this is that binaries are larger than text files, and not diffable (i.e. storing a delta isn't possible). I'm not sure git even works that way as svn did, but the authors of nuget aren't writing just for those using git.

如果您担心包裹丢失,我有两点意见:

If you're concerned about packages going missing, I have two points:

  1. Nuget.org对此非常小心.他们已经进行了设置,以便只能软删除软件包,这意味着还原可以看到那些版本,而nuget install则不能.
  2. 许多人运行自己的内部软件包服务器(例如Klondike),充当nuget.org的代理.如果您希望打包内部库并使用nuget在项目中分发它们,而又不将其发布到互联网上,这也将是有益的.
  1. Nuget.org are quite careful about that not being possible. They've set things up so that packages can only be soft-deleted, which means a restore can see those versions, while a nuget install will not.
  2. Many people run their own internal package server (like Klondike) which acts as a kind of proxy to nuget.org. This is also beneficial if you want to package internal libraries and distribute them in your projects using nuget, without publishing them to the internets.

这篇关于从git签出后缺少nuget dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆