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

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

源错误:

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

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

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


当前回答

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

其他回答

我是这样解决问题的: 只需修复Global.asax中的命名空间。

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

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

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.

我发现在项目中更改命名空间,而没有在整个解决方案中重构它是我的问题。检查你的项目属性,看看你的命名空间是什么,确保排列整齐,全面。

对于我来说,web组装是GAC的一部分……因此,在构建后,它需要安装在GAC和它工作。