Saturday, February 14, 2009

Parser Error Message: Could not load type 'Global'

If you get an error as follows: "Parser Error Message: Could not load type 'Global'" then you may be able to fix this issue by doing the following:
  1. Open the file containing your class Global typically located in the file Global.asax.cs,
  2. Note the namespace for that file
  3. Open the file Global.asax
  4. Locate the line that contains the element "... Application Codebehind=..."
  5. In that line ensure that the element "Inherits=..." includes the namespace for your Global class, e.g. MyWebSite.Global, (Inherits="MyWebSite.Global"). Replace MyWebSite with the namespace noted in step 2
  6. Recompile and redeploys.
  7. The error should be gone.
Note that this post applies to VS2008 and ASP.NET using .NET 3.5. The web site in question hosted web services only. This post may not work for other scenarios or for other root causes.


Anonymous said...

It seems you could also get this message if you try to run a project before building it.

Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!