GuitarRich / sitecore.react.project

Sitecore React Sample Project
MIT License
2 stars 2 forks source link

The type or namespace name 'ApiController' could not be found #1

Open svdoever opened 7 years ago

svdoever commented 7 years ago

Get the following error:

The type or namespace name 'ApiController' could not be found (are you missing a using directive or an assembly reference?) in the project Sitecore.Foundation.Web.

The error is at: C:\P\sitecore.react.project\src\Foundation\Web\code\DependencyInjection\ServiceCollectionExtensions.cs, line 50

When I look at the references in Sitecore.Foundation.Web I see that the reference System.Web.Http can't be resolved.

I have this when opening the solution with Visual Studio 2017. It can be solved by adding the NuGet package Microsoft.AspNet.WebApi.Core to the project Sitecore.Foundation.Web.

I also updated all NuGet packages (twice) to get to latest versions. Hope this works out well:-)

KaranChadha10 commented 3 years ago

You have to install the nuget package Microsoft.AspNet.WebApi and add a using statement using System.Web.Http;

piyushgupta428 commented 2 years ago

You have to install the nuget package Microsoft.AspNet.WebApi and add a using statement using System.Web.Http;

Yup this worked for me, you have to go to tools->NuGet Package Manager-> Manage NuGet Packages for SOlution. Then click on browse search for Microsoft.AspNet.WebApi install that for your solution, meaning check the solution you want it for. then you can use the using statement in your .cs files where you are getting the error.