I am trying to deploy my web project and I keep getting this error:
Line 1: <%@ Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Langu
Problem could occur if you have changed the namespace of your project.
Change the Namespace from Project Properties and also replace all old Namespace with new ones. Renaming to correct namespace might fix the issue.
Source
In my case, I copied the project and pasted it as another project. The Global.asax
file contains the wrong file name, so I just change
<%@ Application Codebehind="Global.asax.cs"
Inherits="WrongAppname.MvcApplication" Language="C#" %>
to
<%@ Application Codebehind="Global.asax.cs"
Inherits="RightAppName.MvcApplication" Language="C#" %>
Deleting Global.asax
and restarting Visual Studio fixed the problem for me.
It's quite weird. Every time I face this issue, have different solution. This time all of the previous fixes failed then I changed project output path from Bin to ..\Build\Bin. It failed. Reverted output path to the previous value , i.e., Bin fixed the issue.
In my case problem occurred after namespace renaming. I didn't use external tool like Re-sharper, I did renaming manually.
In that process, Views/Web.config file was left unchanged. After replacing old namespace name with the new one in this file, the error disappeared.
Same issue i faced , when copy the project from another system. In my case i fixed this issue:
delete everythings from inside Bin folder. Clean & Rebuild the app again
Hope this will help.