Michael
Michael

Reputation: 2101

Ninject.Web.WebApi 3.2.4 GlobalConfiguration.Configure cannot be resolved

I updated the Nuget package Ninject.Web.WebApi from 3.2.3 to 3.2.4. After that update the GlobalConfiguration does not contain the function Configure anymore. That way the following code in the Global.asax.cs does not work anymore:

GlobalConfiguration.Configure(WebApiConfig.Register);

I tried the following:

WebApiConfig.Register(GlobalConfiguration.Configuration);

But that did not work.

Any ideas?

EDIT:

After I install the update via nuget, it removes the following two entries form the packages.config:

<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net451" />

<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net451" />

And in the csproj file it removes the reference to System.Web.Http.WebHost.

After I add them back, the project compiles, but the WebApi Controllers do not work, because Ninject does not inject the parameters. The error is:

An error occurred when trying to create a controller of type 'HomeController'. Make sure that the controller has a parameterless public constructor.

Has something fundamental changed in the latest update?

Upvotes: 3

Views: 1115

Answers (1)

Cayne
Cayne

Reputation: 717

3.2.4 introduced a breaking change, you can read about it in the release notes. You will need to install an additional nuget package now Ninject.Web.WebApi.WebHost.

Upvotes: 6

Related Questions