Just trying to splice some code from one working project to another. The “from” project uses “attribute routing” where you embed
[Route(…)] directives in the Web API controller modules to indicate what HTTP message should route to what service routine.
Works fine in the “from” project, but in the “to” project I get the build error “The type or namespace name ‘Route’ could not be found (are you missing a using directive or an assembly reference?)”
I’ve tried copying essentially all of the
using statements from the “from” project to the “to” project, but that has no apparent effect. None of the MS documentation suggests that a NuGet package is required (or even a
using statement). Both projects are supposedly ASP.NET MVC 4.
(And, yes, I updated WebApiConfig.cs with the
This comment from Vedran Mandić solved the problem for me. I’m re-posting it here because I think it should be the answer (or at least a answer).
I did an ‘Update-Package Microsoft.AspNet.WebApi.WebHost -reinstall’ and it worked. Funny this happens after getting the latest version on different PCs from TFS. I guess this happens because of nuget packages not working properly with the versioning system