简体   繁体   English

为什么更改ASP.NET MVC项目的输出路径会导致“无法加载类型MvcApplication”错误?

[英]Why does changing the Output Path of my ASP.NET MVC project cause the “Could not load type MvcApplication” error?

I experienced the same problem as this popular question where I would receive the following error when my ASP.NET MVC project's Output Path was set to anything but \\bin : 我遇到了与这个常见问题相同的问题,当我的ASP.NET MVC项目的Output Path设置为\\bin其他值时,我将收到以下错误:

Could not load type 'MvcApplication' 无法加载类型“ MvcApplication”

My question is, why does changing the Output Path fix this error? 我的问题是,为什么更改Output Path解决此错误? I have build configurations for each environment I deploy to and I would like to keep the builds segregated (DEV builds to \\bin\\Debug , QA builds to \\bin\\QA , etc). 我为要部署到的每个环境都有构建配置,并且我希望将构建隔离开(DEV生成为\\bin\\Debug ,QA生成为\\bin\\QA等)。 Is there any way to fix this so I can keep separate build Output Path s but not get this error? 有什么办法可以解决此问题,以便我可以保留单独的build Output Path但不会出现此错误?

This issue has been happening since at least 2009 (based on when that question was asked), which leads me to believe it might be an intentional design decision rather than a bug... 这个问题至少从2009年开始就发生过(基于询问该问题的时间),这使我相信这可能是一个故意的设计决定,而不是一个错误。

in VS the bin directory's sub folders (ie, Build, Debug..QA whatever) are defined by VS itself. 在VS中,bin目录的子文件夹(即Build,Debug..QA)由VS本身定义。 You shouldn't need to manually edit the config file. 您无需手动编辑配置文件。

If you're using VS2017 you can go to Build->Configuration Manager and then add a new "Active Solution Configuration" (click on the drop down and select new) 如果您使用的是VS2017,则可以转到Build-> Configuration Manager,然后添加新的“ Active Solution配置”(单击下拉列表并选择新的)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM