0
votes

I recently came across the Nuget Package restore extension which enables a developer to not actually check in DLL's/libraries to TFS & another developer would be able to get the same just prior to the build. This is what we were looking for, particularly when we use external DLL's & hence decided to use it.

I installed the Nuget Package restore, Right clicked on Solution node in Solution Explorer window & clicked Enable Nuget Package restore.

Changes I observed:

  1. .nuget folder with 3 files - NuGet.config, NuGet.exe, NuGet.targets.
  2. Only one project file was modified. (According to this link each of the project file should be modified to import the NuGet.targets MsBuild task). However, in my case only one project file was modified. Is this correct? I guess not.

Test:

  1. I deleted a few DLL's required for the solution to run from different projects. NuGet downloaded the required DLL's in the project that was modified during the installation & placed it under Packages folder. For other projects, the missing DLL's were not downloaded.

I was expecting that all missing DLL's would be downloaded. Am I correct?

Is there something that I'm missing here or doing wrong?

Note: I have ticked the "Allow Nuget to download missing packages during Build" present under Options -> Package Manager -> General.

1
Yes, all project files should be modified and yes, it should download all missing packages. Packages are installed in folders, though. I don't know if NuGet actually recognizes missing DLLs from the depths of the package folders. NuGet can be a severe pain when it comes to handling multiple projects and package dependencies. I'd suggest to update the project files manually and be aware that you're walking down a very dark path anyway. ;)bstenzel
Pain while handling multiple projects - maybe. But I have read on different forums before posting a question here that people are using it for multiple projects. I reckon there must be a way to achieve this.Ankit
Well, yes, but as far as my experience goes, it's not necessarily without manually editing csproj and package.config files.bstenzel
You'd be surprised to know, I did edit the csproj files manually, but that dint help either.Ankit

1 Answers

0
votes

Do not use "Enable Package Restore". That feature has been deprecated as of NuGet 2.7. It was very buggy and tended to not work in certain scenarios.

In fact, at the top of the document you linked, it says to use "Automatic Package Restore".

You can read about it here: http://docs.nuget.org/docs/reference/package-restore

You can migrate to Automatic Package Restore using instructions here: http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore