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

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

源错误:

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

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

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


当前回答

无法加载项目的错误 首先修复你的错误,重建项目后,它的工作

其他回答

I faced the problem in VS 2017 out of no where, took my whole day going through 100 of solutions any of these didnt work. I then took my whole solution and started it on different machine having VS 2017 installation.. IT FINALLY WORKED. Than reinstalled VS 2017 on the original one and it started running on that too. I strongly recommend you try your solution on a different machine before wasting much time to debug it, bcz it is a BUG in VS 2017 as it seemed for me, have reported same to VS TEAM. Hope this helps any one in grief. Cheers.

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

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

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

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

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

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

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.

清空bin文件夹。构建所有依赖类库并在主项目中引用它们,然后构建完整的解决方案。