Parser Error Could Not Load Global.asax
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “Could not load type [Namespace].Global” causing me grief up vote 77 down vote favorite 18 In my .Net 2.0 Asp.net WebForms app, I have my Global.asax containing the following code: <%@ Application CodeBehind="Global.asax.cs" Inherits="MyNamespace.Global" Language="C#" %> However when I build I get an error stating- Could not load type 'MyNamespace.Global'. This seems to be because the MyNamespace namespace (defined in the code behind file Global.asax.cs) is not seen by the compiler in the Global.asax file (does not show in R# intellisence..). This turned out to be a very hard nut to crack... any help will be appreciated! Note: The Global.asax and the Global.asax.cs are located in the same folder. Note2: When compiling from the vs prompt with csc it compiles o.k. c# asp.net webforms namespaces global-asax share|improve this question edited Jan 31 '15 at 1:13 BenSmith 8,39932646 asked Jan 5 '10 at 11:39 gkdm 90521124 Do other pages in the app work? Sometimes this happens when the webserver is configured to run 1.1 but the app is compiled for 2.0 –Noon Silk Jan 5 '10 at 11:43 yes, 'Target Framework' is 2.0 –gkdm Jan 5 '10 at 11:52 add a comment| 24 Answers 24 active oldest votes up vote 114 down vote accepted One situation I've encountered which caused this problem is when you specify the platform for a build through "Build Configuration". If you specify x86 as your build platform, visual studio will automatically assign bin/x86/Debug as your output directory for this project. This is perfectly valid for other project types, except for web applications where ASP.NET expects the assemblies to be output to the Bin folder. What I found in my situation was that they were being output to both (Bin and Bin/x86/Debug), with the exception that some of the dll's, and inexplicably the most important one being your web application dll, being missing from the Bin folder. This obviously caused a compilation problem and hence the "Could not load type Global" exception. Cleaning the solution and deleting the assemblies made no difference to subsequent builds. My solution was to just change the output path
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error: «Could not load type MvcApplication» up vote 196 down vote favorite 31 I am getting the error Could not load type MvcApplication when I try to run my website. How http://stackoverflow.com/questions/2005747/could-not-load-type-namespace-global-causing-me-grief to correct it? asp.net-mvc share|improve this question edited Mar 6 at 20:34 community wiki 5 revs, 4 users 48%Gil 30 I got this error randomly one day on our build server. doing a manual rebuild resolved it. –Zack Aug 14 '09 at 21:27 1 The Output path is set in the project properties on the build tab –silasdavis May 2 '12 at 12:04 7 delete global.asax file and add a new one, and you will http://stackoverflow.com/questions/1120329/error-could-not-load-type-mvcapplication be alright. –DotNetGeek Jul 8 '13 at 7:51 2 It turns out that the new project was not selected in the active configuration for build. –JGeerWM Jan 28 '15 at 19:11 3 If you recently added the project or if you recently changed the publish configuration (i.e. switched from AnyCPU to x64) then it might be that the project is not built when you run it. Go to BUILD-> CONFIGURATION MANAGER and check the build column has the check box ticked. I have just had this issue now You will also notice that your breakpoints are clear circles when running the application. I think this is a result of the default build for .net 4.5.1 on processor architecture favouring 32 bit. Only an issue if you check x64 –David Bridge Jul 22 '15 at 9:29 | show 4 more comments 35 Answers 35 active oldest votes 1 2 next up vote 77 down vote As dumb as it might sound, tried everything and it did not work and finally restarted VS2012 to see it working again. share|improve this answer answered Aug 8 '13 at 18:58 community wiki gurrawar 1 +1 This worked for me. –Brent Jan 29 '14 at 16:58 7 +1 stop and start fixes everything –Hazza Feb 11 '14 at 17:02 1 LMFAO, worked for me too after trying out everything mentioned here and didn't work! Thanks
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more http://stackoverflow.com/questions/11596352/parser-error-server-error-in-application about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each http://www.codeproject.com/Questions/376141/Parser-error-Could-not-load-type other. Join them; it only takes a minute: Sign up Parser Error: Server Error in '/' Application up vote 25 down vote favorite 3 I got the following error: "An error occurred during the parsing of a resource parser error required to service this request. Please review the following specific parse error details and modify your source file appropriately." Parser Error Message: `Could not load type 'nadeem.MvcApplication'`. Source Error: Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="nadeem.MvcApplication" Language="C#" %> asp.net-mvc-3 code-behind share|improve this question edited Dec 5 '14 at 14:09 alex 1,86211643 asked Jul 21 '12 at 22:30 Arslan Sunny 2122616 1 Be sure that your DLLs of your project are in the proper path. You may set the parser error could output path of you build in another folder outside your project, and when, for example, the project runs and searches for DLLs in the bin folder, it doesn't find them. –user1897631 Dec 12 '12 at 11:26 If that's because you change the default output directory, you can use this way:stackoverflow.com/a/26237022/1900498 –qakmak Oct 7 '14 at 13:23 y'all aren't going to believe this but this project in our solution wasn't selected in the Solution Configuration Manager to be built so there was no DLL being created in /bin ! Just make sure your project in question is selected to build in the Configuration Manager.... –jbwebtech Aug 4 '15 at 21:36 add a comment| 13 Answers 13 active oldest votes up vote 43 down vote accepted Right-click your Global.asax file and click View Markup. You will see the attribute Inherits="nadeem.MvcApplication". This means that your Global.asax file is trying to inherit from the type nadeem.MvcApplication. Now double click your Global.asax file and see what the class name specified in your Global.asax.cs file is. It should look something like this: namespace nadeem { public class MvcApplication: System.Web.HttpApplication { .... If it doesn't, then you will receive the error you received. The value in the Inherits attribute of your Global.asax file must match a type that is derived from System.Web.HttpApplication. share|improve this answer edited Jul 21 '12 at 22:45 answered
Tips/Tricks Top Articles Beginner Articles Technical Blogs Posting/Update Guidelines Article Help Forum Article Competition Submit an article or tip Post your Blog quick answersQ&A Ask a Question View Unanswered Questions View All Questions... Linux questions C# questions ASP.NET questions SQL questions fabric questions discussionsforums All Message Boards... Application Lifecycle> Running a Business Sales / Marketing Collaboration / Beta Testing Work Issues Design and Architecture ASP.NET JavaScript C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Free Tools Objective-C and Swift Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Android iOS Mobile SharePoint Silverlight / WPF Visual Basic Web Development Site Bugs / Suggestions Spam and Abuse Watch features Competitions News The Insider Newsletter The Daily Build Newsletter Newsletter archive Surveys Product Showcase Research Library CodeProject Stuff communitylounge Who's Who Most Valuable Professionals The Lounge The Insider News The Weird & The Wonderful The Soapbox Press Releases Non-English Language > General Indian Topics General Chinese Topics help What is 'CodeProject'? General FAQ Ask a Question Bugs and Suggestions Article Help Forum Site Map Advertise with us About our Advertising Employment Opportunities About Us Ask a Question All Questions All Unanswered FAQ Parser error: Could not load type Rate this: Please Sign up or sign in to vote. See more: C# ASP.NET Parsing Hi! Now, I know what you're thinking ("Not another parser error!"). But my situation is unique. (No, really! ;-) ) I could use your help. Let me tell you what the error is: Server Error in '/' Application. -------------------------------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'TestCert'. Source Error: Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestCert.aspx.cs" Inherits="TestCert" %> Line 2: Line 3: Source File: /TestCert.aspx Line: 1 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634 The situation is I have a bunch