简体   繁体   English

在MVC项目的引用中找不到文件异常

[英]File not found Exception in References of MVC Project

When I start up ASP.NET MVC project in Visual Studio, I get this error: 当我在Visual Studio中启动ASP.NET MVC项目时,出现此错误:

File not found exception wasn't handled in the user code An exception of type 'System.IO.FileNotFoundException' occurred in 在用户代码中未处理未找到文件异常的情况在以下情况中发生了类型为'System.IO.FileNotFoundException'的异常
System.Web.Mvc.dll but was not handled in user code System.Web.Mvc.dll,但未在用户代码中处理

Additional information: Could not load file or assembly 'System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 附加信息:无法加载文件或程序集'System.Web.Razor,版本= 2.0.0.0,区域性=中性,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。

Update: 更新:

As it seems, @alorika's answer was the correct one (Missing reference to System.Web.Razor ) 看来,@ alorika的答案是正确的(缺少对System.Web.Razor引用)

Old answer: 旧答案:

Which version of Visual Studio are you using? 您正在使用哪个版本的Visual Studio? Which version of MVC? 哪个版本的MVC? What I would try as first is to repair the installation. 我首先尝试的是修复安装。 Just go to Control panel -> Installed programs -> Select VS and click on change/repair. 只需转到控制面板->已安装程序->选择VS,然后单击更改/修复。

On the window that opens, select repair and let the program run. 在打开的窗口中,选择修复并运行程序。 VS维修

If that doesn't help, go again to all programs and again select VS and then click on repair. 如果那没有帮助,请再次转到所有程序,然后再次选择“ VS”,然后单击“修复”。 But this time, in the VS window, which opens select modify and make sure, that "Microsoft Web Developer Tools" is checked (if it is not, check it and hit "Update"): 但是这次,在打开的VS窗口中,选择Modify,并确保已选中“ Microsoft Web Developer Tools”(如果未选中,请选中并单击“ Update”):

VS修改

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM