I get the following error when trying to update-package on the NuGet Console:
At line:1 char:1 + Update-Package Microsoft.AspNet.WebApi -reinstall + CategoryInfo : InvalidOperation: (:) [Update-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetMissingPackages, NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
When I try to install
NuGet.PackageManagement.PowerShellCmdlets I get the error:
An error occured while trying to restore packages:Unable to find version '5.2.3' of package 'System.Net.Http.Formatting'.
In the .csproj file the version is 5.2.3 for System.Net.Http.Formatting
<Reference Include="System.Net.Http.Formatting, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> <HintPath>..\packages\System.Net.Http.Formatting.Extension.22.214.171.124\lib\System.Net.Http.Formatting.dll</HintPath> </Reference>
...and in the
packages.config file the version is 5.2.3 for the package
<package id="System.Net.Http.Formatting" version="5.2.3" targetFramework="net461"/>
In the properties of references the version is 126.96.36.199 and the runtime version is v4.0.30319 for
So my problem is that I cannot reinstall
System.Net.Http.Formatting because it is now part of
Microsoft.AspNet.WebApi apparently and when I try to install it I get the original error. I am going around in circles.
If I just run the project as it is it compiles and I get the runtime error:
Could not load file or assembly 'System.Net.Http.Formatting, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
Where is it getting this version 184.108.40.206 from? And if it is a dependency that is the problem I need to reinstall but I can't.
I am very inexperienced with packages and NuGet. All these problems arose when a coworker updated a few packages and put these changes in git but my project did not compile.
This is how I solved the problem. I deleted the DLL
System.Net.Http.Formatting. I made sure it was deleted from the
.csproj file and the
Then I uninstalled the packages
Microsoft.AspNet.WebApi.Client using NuGet.
Then I reinstalled the packages using NuGet, but I did not reinstall the
The dependent code in that originally required it is now in part of
Microsoft.AspNet.WebApi.Client. It installed the
System.Net.Http.Formatting package and the version 5.2.6 which my Solution was originally looking for and complaining about when it could not find it.
User contributions licensed under CC BY-SA 3.0