Could Not Load Type Error In 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 4.7 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 76 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,35932646 asked Jan 5 '10 at 11:39 gkdm 89521124 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 112 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 assemblie
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 4.7 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 http://stackoverflow.com/questions/2005747/could-not-load-type-namespace-global-causing-me-grief favorite 31 I am getting the error Could not load type MvcApplication when I try to run my website. How 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 http://stackoverflow.com/questions/1120329/error-could-not-load-type-mvcapplication 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 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 76 down vote As dumb as it might sound, tried everything and it did not work and finally restarted VS2012 to see it
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 http://stackoverflow.com/questions/19029104/visual-studio-cannot-load-type-from-global-asax 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 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Visual Studio cannot load could not type from global.asax up vote 0 down vote favorite I know this issue has been raised before, but the solutions available have not resolved my problem. I have a global.asax file that I did not write, in my solution. The namespace and class from the cs file match the inheritance namespace and class. What caused the issue was something simple: I excluded a directory from could not load the solution, then re-included it. Since then, the error below occurs when I attempt to build my solution: 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 'EnableWebApp.Global'. Source Error: Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="EnableWebApp.Global" Language="C#" %> Source File: /global.asax Line: 1 I have cleaned, rebuilt, reinstalled these files, restarted the framework, and rebooted my system. Nothing has resolved it yet. Global.asax "<%@ Application Codebehind="Global.asax.cs" Inherits="EnableWebApp.Global" Language="C#" %>" Global.asax.cs namespace EnableWebApp { public class Global : System.Web.HttpApplication { visual-studio-2012 share|improve this question edited Sep 26 '13 at 13:35 asked Sep 26 '13 at 13:03 stevenpepe 121214 add a comment| 3 Answers 3 active oldest votes up vote 0 down vote accepted I have spent the spent the last 2 days fighting with this error. This is my scenario and how I solved it. (and I code in VB.. not as advanced as most of you guys and gals.) 1) I added the web code folder to my proje