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

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

源错误:

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

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

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


当前回答

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

其他回答

我花了好几天时间研究这个问题。我最终通过以下这篇文章中的建议解决了这个问题。

将平台目标更改为任意CPU。我目前没有这个配置,所以我必须去配置管理器并添加它。我专门为x64编译。仅凭这一点并不能解决错误。 将输出路径更改为bin\而不是bin\x64\Debug。在我改变平台目标之前,我已经尝试过几次了。它只会得到一个错误,因为格式无效而无法加载程序集。

要明确的是,在它开始工作之前,我必须做这两件事。我已经尝试了多次,但它从来没有解决,直到我做了两个。

如果我将这些设置中的任何一个更改回原来的设置,我将再次得到相同的错误,尽管已经运行了Clean Solution,并手动删除了bin目录中的所有内容。

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

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

尝试修改全局变量。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.

我只是在一个MVC5应用程序上遇到了这个问题,没有什么对我有用。这发生在我试图将SVN还原到项目的旧版本之后。

我必须删除Global. asax.cs,然后通过右键单击项目->添加新项目-> Global来添加一个新的项目。asax和THAT最终解决了它。

只是觉得也许能帮到别人。