RegisterWebApiControllers not exists. Compile error.

Jun 17, 2014 at 5:22 PM
   When remove the reference. And I add the SimpleInjector.webApi and SimpleInjector.Net project.

 var container = new Container();

        InitializeContainer(container);

        container.RegisterWebApiControllers(config);
        container.RegisterWebApiFilterProvider(config);

RegisterWebApiControllers throw exception.
RegisterWebApiFilterProvider throw exception.

I search all the project.
just find
public static void RegisterWebApiControllers(this Container container, HttpConfiguration configuration)

But this is not what I need.
Coordinator
Jun 17, 2014 at 5:33 PM
Which reference did you remove? Please post the complete exception information (exception type, message and stacl trace of the exception and all its inner exceptons).
Jun 17, 2014 at 6:12 PM
either SimpleInjector or SimpleInjector.Integration.WebApi

the exception will be throwen
Coordinator
Jun 17, 2014 at 6:15 PM
I'm sorry, but without more specific information, I'll be unable to assist you with this.
Jun 17, 2014 at 6:26 PM
Error 1 Instance argument: cannot convert from 'SimpleInjector.Container' to 'SimpleInjector.Container'

Error 2 'SimpleInjector.Container' does not contain a definition for 'RegisterWebApiControllers' and the best extension method overload 'SimpleInjector.SimpleInjectorWebApiExtensions.RegisterWebApiControllers(SimpleInjector.Container, System.Web.Http.HttpConfiguration)' has some invalid arguments

Error 3 The type 'SimpleInjector.Container' is defined in an assembly that is not referenced. You must add a reference to assembly 'SimpleInjector, Version=2.5.0.0, Culture=neutral, PublicKeyToken=null'.

Error 4 Instance argument: cannot convert from 'SimpleInjector.Container' to 'SimpleInjector.Container'

Error 5 'SimpleInjector.Container' does not contain a definition for 'RegisterWebApiFilterProvider' and the best extension method overload 'SimpleInjector.SimpleInjectorWebApiExtensions.RegisterWebApiFilterProvider(SimpleInjector.Container, System.Web.Http.HttpConfiguration)' has some invalid arguments

Error 6 The best overloaded method match for 'SimpleInjector.Integration.WebApi.SimpleInjectorWebApiDependencyResolver.SimpleInjectorWebApiDependencyResolver(SimpleInjector.Container)' has some invalid arguments

Error 7 Argument 1: cannot convert from 'SimpleInjector.Container [c:\Source_test\DROM\packages\SimpleInjector.2.5.0\lib\net45\SimpleInjector.dll]' to 'SimpleInjector.Container'
Jun 17, 2014 at 6:50 PM
How do you think about those errors?
Do you need more info?
Coordinator
Jun 17, 2014 at 7:54 PM
Which version of SimpleInjector.dll to you reference in your application? You are probably mixing different versions together, since the application is expecting version 2.5.0.0, but you probably included a different version.

If you use some dll that references an older version, you might want to configure an assembly binding, as explained here.
Jun 18, 2014 at 4:06 PM
I doubt that the code described as version 2.5.0.0 is not the version you published DLL.

My concern is that the latest version DLL is not generated from the code you published.

Can you double check that.

And I search all of the code by 'RegisterWebApiControllers'

Just find one function.
Coordinator
Jun 18, 2014 at 4:52 PM
The only NuGet package that contains the SimpleInjector.dll 2.5.0.0 assembly is the NuGet package for Simple Injector 2.5.0.