大会参考丢失时迁移Asp.net MVC4从公测到4 [英] Assembly reference missing when migration Asp.net MVC4 from beta to 4

查看:167
本文介绍了大会参考丢失时迁移Asp.net MVC4从公测到4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作从Asp.net MVC4公测Asp.net MVC4迁移工作,但我不得不缺少的dll引用的问题。请帮助我。

I was working on a migration job from Asp.net MVC4 beta to Asp.net MVC4, But I had a problem of dll reference missing. please help me .

public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = System.Web.Http.RouteParameter.Optional }
            );


            routes.MapRoute(
               name: "Default",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "Login", action = "Login", id = UrlParameter.Optional }
           );
        }

上面的code不能编译成功,和Visual Studio说 System.Web.Routing.RouteCollection'不包含定义'MapHttpRoute',没有扩展方法'MapHttpRoute接受型System.Web.Routing.RouteCollection'的第一个参数可以找到(是否缺少using指令或程序集引用?)

Above the code can't be compiled successfully, and Visual studio said System.Web.Routing.RouteCollection' does not contain a definition for 'MapHttpRoute' and no extension method 'MapHttpRoute' accepting a first argument of type 'System.Web.Routing.RouteCollection' could be found (are you missing a using directive or an assembly reference?)

更重要的是这样的问题经常在这些日子里happened.Because的Asp.net MVC变化的版本如此频繁。所以没有Windows Azure的客户端API的版本。这是很烦人的疑难问题希望有人可以给如何处理它的一些提醒。谢谢。

More important thing is this kind of problem often happened.Because the version of the Asp.net MVC change so frequently in these days. and So did the version of Windows Azure Client ApI. It is very annoying problem.I hope someone can give some advise of How to deal with it. thanks.

推荐答案

我已经在RouteConfig.cs增加System.Web.Http参考解决它。

I have solved it by adding a reference to System.Web.Http in RouteConfig.cs.

这篇关于大会参考丢失时迁移Asp.net MVC4从公测到4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆