当包本地存储在 diff 文件夹中时,nuget 包项目引用是否会弄乱?

问题描述:

当另一个开发人员从 TFS 中的存储库获取最新信息时,解决方案中每个项目的引用似乎没有正确链接.

When another developer gets latest from the repository in TFS, the references for each project in the solution don't seem to link up correctly.

据我推测,如果您使用 nuget,它会自动为您提取必要的库,不是吗?我是否必须进入 vs.net 并告诉它下载库?

From what I assumed, if you use nuget, it will automatically pull the necessary libraries for you no? Do I have to go into vs.net and tell it to download the libraries?

或者我是否在 TFS 中添加了一些我不应该拥有的东西,以至于它假设我的包存储在特定路径中,而当其他开发人员下载存储库时它们可能不在?

Or did I add something into TFS that I shouldn't have such that it is assuming my packages are stored at a particular path when they might not be when another developer downloads the repository?

这是 vs.net 2010.

This is vs.net 2010.

我遇到了一些类似的问题,所以我将 NuGet 模式切换为不 将包提交到源代码控制.

I had some similar issues so I switched NuGet modes to not commit packages to source control.

  1. 转到选项 -> 包管理器 -> 常规 并选中允许 NuGet 在构建期间下载丢失的包"复选框,然后按好的".
  2. 在 Visual Studio 解决方案资源管理器中右键单击解决方案,然后选择启用 NuGet 包还原".
  1. Got to Options -> Package Manager -> General and check the "Allow NuGet to download missing packeges during build" CheckBox and press "OK".
  2. Right click on the solution in the Visual Studio Solution Explorer and select "Enable NuGet Package Restore".

我还在 解决方案文件夹.这样我就可以右键单击解决方案并选择签入...",所有相关文件都将被签入.如果你这样做,那么不包含任何包文件(如 .dll 文件)非常重要在解决方案或 TFS 中,因为这将导致 NuGet 无法正常工作.如果您选择不这样做,则需要使用待定更改窗口或右键单击源代码管理资源管理器中的解决方案文件夹并选择签入挂起的更改..."

I also added the contents of the .nuget and packages folders (which the previous steps created in the solution's folder) to the solution in solution folders. This way I can right click on the solution and select "Check In..." and all relevant files will be checked in. If you do this then it is very important that none of the package files (like .dll files) are included in the solution or TFS as this will cause NuGet to not work correctly. If you choose not to do this then you will need to check in your changes using the Pending Changes window or by right clicking on the solution folder in Source Control Explorer and selecting "Check In Pending Changes..."

我的 .nuget 解决方案文件夹包含以下文件:

My .nuget solution folder contains the following files:

  • Notes.txt 描述了我如何设置 NuGet、为什么我按照我的方式设置它以及任何使用说明/问题.
  • NuGet.config
  • NuGet.exe
  • NuGet.targets

我的包解决方案文件夹包含以下文件:

My packages solution folder contains the following files:

  • repositories.config