version-control - NuGet 和版本控制 - 如何处理目录文件夹

标签 version-control nuget

使用较新版本的 NuGet,不再需要对 packages 文件夹进行版本控制,将其添加到 .gitignore 文件中非常简单。

但是,某些 NuGet 包还会将文件添加到 Contents 文件夹,问题是如何处理?我认为那些文件也应该被 git 忽略,但是维护可能复杂的内容排除规则是否可行?

最佳答案

当您阅读“Enabling Using NuGet Without Checking In Packages Folder”的理由时,它是关于:

This new feature will make it so that if the packages folder (or any package folder within the packages folder) is missing, the packages folder (or missing package folder) will automatically be restored when compiling the application. This ensures that the application will compile even though the packages folder was missing at the time.

所以基本上可以重新生成的内容没有版本控制。
一般的想法是,如果它不能轻易地重新生成或获取,则应该对其进行版本控制

而且您放入 Content 的内容似乎不属于该类别,如文章“Creating a NuGet Package in 7 easy steps - Plus using NuGet to integrate ASP.NET MVC 3 into existing Web Forms applications”中的示例所示;

Step 2 - Add stuff to your Content Folder

Since I want my NuGet package to add stuff to folders in my target Web Application, I put whatever I want in a folder called Content. Anything in that will show up in the root of my target project. This can be CSS, JS, CS or VB files, whatever. These files will all get dropped onto the project your package is applied to.

Content folder

所以版本控制说 Content 可能是可取的。

关于version-control - NuGet 和版本控制 - 如何处理目录文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9102344/

相关文章:

c# - 创建包时找不到文件

xcode - 使用Xcode将现有项目添加到BitBucket

svn - 在 Xcode 中使用 Subversion

version-control - AnkhSVN 好用吗?

git - 如何在不使用 NuGet 的情况下获取 GitHub 上列出的具有 NuGet 包的库的二进制文件?

c# - PCL 可移植 - NuGet 不支持

version-control - bzr merge - 在提交之前审查另一个分支提交说明 ('merge tips' )

c++ - 如何告诉git我的本地目录是远程树中的特定目录

nuget - 依赖于特定的 nuget 包

visual-studio - NuGet 包资源管理器中的 "Supported Framework"字段的正确用法是什么?