Nuget package does not point to the installed package

Asked

Viewed 54 times

0

I have an app, just like a package Nuget. The package in question is the:

System.Net.Http

This application has the target framework set to .NET Framework 4.7.2.

When checking in the project to where the dll is being referenced, I see that the path reference is pointing to a. net framework folder and not to the "Packages" folder (which is the common):

C: Program Files (x86) Reference Assemblies Microsoft Framework.Netframework v4.7.2 System.Net.Http.dll

At first this is not exactly a problem... In my machine everything works perfectly.

But I have a continuous integration server, which has . net framework 4.7 installed and even then I end up getting error while running my tests.

The error in question is this:

Test method View.test.Defaulttokenservicotest.Testaautorizacaoapi threw Exception: System.IO.Filenotfoundexception: Could not load file or Assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, Publickeytoken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Now I don’t know if it’s right dll point to that path or if there is something left to install on this server...

On this server I can build, publish and run other tests normally... Only the tests that use this package that ends up giving error.

Would anyone know what to say?

File Packages.config:

<packages>
  <package id="FakeItEasy" version="4.9.1" targetFramework="net451" />
  <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net451" />
  <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net451" />
  <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net451" />
  <package id="Oracle.ManagedDataAccess" version="12.2.1100" targetFramework="net451" />
  <package id="System.Net.Http" version="2.0.20126.16343" targetFramework="net451" />
  <package id="System.Net.Http.Formatting.Extension" version="5.2.3.0" targetFramework="net451" />
</packages>

And in . csproj I have the following:

<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <HintPath>..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\System.Net.Http.Formatting.Extension.5.2.3.0\lib\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
  <HintPath>..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.WebRequest.dll</HintPath>
  <Private>True</Private>
  <Private>True</Private>
</Reference>
<Reference Include="System.Web" />
  • Only to download consciousness: on the server, all DLL’s are in the folder bin, right?

  • In the folder bin both on my machine and on the server there is no such dll... I do not know why it is not copied. But on the server and on my machine I have this dll in the folder cited there in the question.

  • Add to the question the project and test *.csproj, as well as the Packages.json. Also add the dll version in 2 cases (you can find this information in the reference properties in VS).

  • I managed to resolve reinstalling the . net framework. From what I understand this dll is coming from the GAC, but I still don’t understand why...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.