我在一个MVC3项目上工作,收到以下错误:

解析器错误信息:无法加载类型“GodsCreationTaxidermy.MvcApplication”。

源错误:

第1行:<%@ Application Codebehind="Global.asax.cs" Inherits="GodsCreationTaxidermy.Core. core . "MvcApplication" Language=" c# " %>

我得到的错误是无法加载GodsCreationTaxidermy.Core.MvcApplication,但在这个屏幕截图中,核心部分没有显示在错误中:

有人对这个错误有什么想法或解决方案吗?


当前回答

尝试修改全局变量。Asax文件(简单添加一个空格的地方),并重新运行。这将迫使内置的web服务器刷新和重新编译全局。asax文件。

也做一个清理和重建-应该修复问题

其他回答

我用很简单的方法修好了它。你所要做的就是删除ProjectName\bin文件夹中的所有文件,然后从Visual studio顶部菜单栏Build->Rebuild Solution再次重建项目,你就完成了。现在试着运行这个项目。这个过程在Visual Studio 2022中为我工作。

Yes, I read all the answers. However, if you are me and have been pulling out all of what's left of your hair, then try checking the \bin folder. Like most proj files might have several configurations grouped under the XML element PropertyGroup, then I changed the OutputPath value from 'bin\Debug' to remove the '\Debug' part and Rebuild. This placed the files in the \bin folder allowing the Express IIS to find and load the build. I am left wondering what is the correct way to manage these different builds so that a local debug deploy is able to find and load the target environment.

从解决方案根目录中删除.vs目录。清洁。重建。

这个问题有时会让我发疯,我不可避免地会在这里翻找答案。我怀疑有多种原因可以产生这种异常,这一次为我工作。

我在一个非常古老的溶液中有这个。事实证明,真正的问题是这些项目构建到4.6.1,而不是其他被引用的dll构建到4.7.2。在将解决方案中的所有项目更改为4.7.2后,它成功构建并运行应用程序。

检查项目输出路径(项目属性/ Build)设置为bin而不是bin\Release或bin\Debug

由于某些原因,IIS (VS开发服务器或本地IIS)总是从bin目录访问库(并且不会查找子目录)