2
votes

I have a solution which is using the NuGet package LZ4.NET.

The package stores dlls in the content folder, which gets copied over to the target project root directory.

This has been checked into source control (Git), but the dlls in the project are excluded.

Currently the packages folder is checked in, which has both lib and content directories with all the necessary dll files.

But when cloning a new repository, building the project does not copy the contents into the project, and visual studio gives an error that the dlls are missing (as they have been included in the project but excluded from source control).

How can I get nuget to copy the content each time it builds? Or should I just check in the dlls into the project?

Update

I have enabled NuGet package restore. But it seems that by design Nuget does not support restoring of content files. If that is the case, it seems like I must check in the dlls in the project.

But the dlls are organised by .Net Framework version, i.e. net35, net40, net45. If I check in the dlls, then it will be "locked" to the .Net framework version I check in, rather than rely on Nuget to chose for me.

1

1 Answers

1
votes

When a package is installed into a project, NuGet in fact performs these operations,

  1. Download the package file from source;
  2. Install the package into the so called packages folder, which is $(SolutionDir)\packages by default;
  3. Install the package into the project, which consists of adding references to DLLs, copying content files into the project directory etc.

When a package is restored, only the first two steps are executed. Which is why the DLLs in your project directory will not be "restored".

The only solution for now is to check in the DLLs in your project directory.