M
M
MarkizaSckuza2016-01-21 17:31:21
.NET
MarkizaSckuza, 2016-01-21 17:31:21

Why aren't NuGet dependencies loaded into code?

Hello!
Such a problem: packages.config contains all the necessary dependencies, as well as in the packages folder, the NuGet Package Manager shows the installed packages for the solution, i.e., everything has been downloaded and installed. But only these libraries are not loaded in the code - 14 thousand errors like "are you missing a using directive or an assembly reference?". What could I have missed?
Perhaps I made a completely stupid mistake somewhere, please don’t blame me, I’m trying to run a real project on .NET for the first time, before that I only worked with Java.
UPD: Visual Studio 2015, NuGet 3.3.0.167

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2016-01-21
@MarkizaSckuza

1) check if nuget restore is running. Just open the packages yourself, go to the folders of specific packages and check that the downloaded assemblies are there
2) unfortunately, in classic C# projects (not DNX), interaction with NuGet is rather mediocre. In the sense that the contents of the project and packages.config may be out of sync (due to the lack of a single list of packages / assemblies, as was done in project.json). Those. everything will be in packages.config, but these links will not be written in csproj.
The way out of the situation is to open the csproj handles and put the necessary References by writing relative paths to the assemblies in packages, like these:

<Reference Include="NetTopologySuite.IO.ShapeFile">
      <HintPath>..\..\packages\NetTopologySuite.IO.1.13.3.2\lib\net40-client\NetTopologySuite.IO.ShapeFile.dll</HintPath>
    </Reference>

You need to look at the specific path (how many levels to "exit" and which folders to "enter"). First, of course, you need to check if these links already exist - perhaps the packages folder for some reason just left for a new place, and the paths just got corrupted.

A
Aleksej, 2016-01-21
@Shwed_Berlin

using directives, you yourself must
right-click on an unrecognized element in each file -> resolve
PS I have a German version of VS, the name of the item in the context menu may be called other than "resolve"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question