我得到了错误

无法加载类型mvcapapplication

当我试图运行我的网站时。

如何纠正?


当前回答

我得到这个错误是因为我正在运行项目,尽管有一些编译时错误。这一点我没有注意到。

其他回答

在解决方案上手动构建即可。

如果您正在使用本地IIS,请尝试在IIS管理器中删除网站注册,然后手动重新创建。

In some circumstances, new projects you create are not by default set to build. If you right-click on your solution, choose Properties, and choose the Configuration Properties | Configuration node on the left and ensure your project has a checkmark under the Build column. In normal circumstances I've found this happens by default. In other circumstances (I happen to have a somewhat complex Web Api / Xamarin Android and iOS / Mvc 5 solution that exhibits this behavior) the checkmark isn't present.

这与其他答案相关——如果你的web项目的程序集不可用,你会得到这个错误。但这可能是一个常见的场景,特别是因为您实际上编译了您的解决方案——项目只是没有得到构建。

我正在使用Azure移动应用程序,当我添加MVC控制器时,出现了这个问题。如果你从团队资源管理器(撤销)中删除所有文件,你需要从解决方案文件夹中删除bin, obj和Global.asax.cs

我有同样的问题,解决它与以下步骤

转到项目属性 在“Build”选项卡上,将输出路径设置为“bin\”

这种情况发生在我身上,因为我将Global.asax.cs (c#文件)添加到VB.net项目中,所以文件没有被编译,我必须使用文件的.vb版本才能工作和编译。