Annoying Build Error while Implementing the IControllerFactory Interface
Today I wanted
in the MVC
regard to the
IControllerFactory interface. I couldn’t guessed that it will take me
ten minutes to figure out an annoying build error which I will
explain here how to resolve it.
You want to implement the IControllerFactory interface but not in
the MVC framework generated web application. The implementation
would exists in another class library. I set a reference for the
System.Web.Mvc dll and also to the System.Web dll (which holds the
System.Web.Routing.RequestContext which is needed for the
I finished to implement the interface and compiled the solution.
A very strange “does not implement interface member
System.Web.Routing.RequestContext, string)” error message is
jumping at me from the Error List View. Since I know that I
finished to implement all the methods in the interface this error is
very interesting and annoying.
I searched the web for indications about this error and found
some references without any solution such as this post.
I tried to figure out what was missing. So I guessed that I wasn’t
referencing another assembly which causes the inappropriate error.
My first guess was the System.Web.Routing dll. I referenced it
and the build succeeded without any errors.
Sometimes more informative errors can help you to find the
problems you face. In this case the error wasn’t helpful and
lead me to think that something in my implementation was
wrong. I hope that this post will help you if you get stuck
with this error.