我得到了错误

无法加载类型mvcapapplication

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

如何纠正?


当前回答

我的问题是我还没有建立这个项目(糟糕)。不知道这是否真的有助于任何人,但只是确保你在点击链接之前构建一切。

其他回答

对我有效的是重新启动Visual Studio。

我尝试手动重建,执行清理和重建,并删除bin文件夹,所有这些都没有工作。我的输出路径已经设置为bin\

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

如果您正在使用本地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项目的程序集不可用,你会得到这个错误。但这可能是一个常见的场景,特别是因为您实际上编译了您的解决方案——项目只是没有得到构建。

删除站点bin文件夹的内容(使用文件资源管理器进行此操作)。重建。