Although I had the same problem, the answers in this thread didn't fully help me to fix the problem. For this reason, I decided to write the result of my research in this post. To fix this issue, follow the steps below:
- Add the Microsoft.AspNet.WebApi.Client package to the project using NuGet. While inside the ASP.NET solution, open the Package Manager Console by going to
Tools > NuGet Package Manager > Package Manager Console
in Visual Studio IDE and add the Microsoft.AspNet.WebApi.Client
package to the solution.
Install-Package Microsoft.AspNet.WebApi.Client -Version 5.2.7
- After its installation, check that the extensions DLL exists on your system.
System.Net.Http.Formatting.dll
file should be present in the directory shown below as a result of the first step.
{root-solution-directory}\packages\Microsoft.AspNet.WebApi.Client.{package-version}\lib\net45\
Manually add the reference to the relevant project. Right click on the "References" section in the ASP.NET project within the solution click on the "Add Reference..." section. Since the file System.Net.Http.Formatting.dll
is an extension, it will not be listed when searched directly like other items in the Microsoft.AspNet.WebApi.Client
package. Therefore, to add the DLL file manually, click the "Browse..." button at the bottom of the "Reference Manager" window. Select the System.Net.Http.Formatting.dll
file in the directory shown in the second step and check the checkbox to include the DLL file in the project.
Include the System.Net.Http
namespace in the project to use the features provided by this DLL in the project; using System.Net.Http.Formatting;
declaration is available within the HttpContentExtensions
static class.
using System.Net.Http;
OPTIONAL: You can achieve a similar solution by installing one of the System.Net.Http.Formatting.Extension or WebApiDoodle.Net.Http.Formatting packages and following the steps above.