Share via


ASP.NET - Could not load type Global.asax compilation error

Question

Wednesday, August 21, 2013 11:48 AM

I have a website which was compiling fine.

It has a Global.asax file of the following code:

<%@ Application Codebehind="Global.asax.cs" Inherits="MyClass.Global" %>

Now it is throwing an error: Could not load type 'MyClass.Global'  in the file Global.asax file

I have seen a solution whereby one would change the output folder from: 

Project Properties

 and set the 

build>output

 folder to 

bin/

 which was 

bin/Debug

I just can't find this menu. I saw Property Pages which has a build option - but I can't find anywhere to set the build output to the bin folder.

Can you please guide me to the correct menu.

Thanks.

All replies (4)

Wednesday, August 21, 2013 12:08 PM âś…Answered

The "Build output path" can by found by right-clicking on your ASP.NET Project in Solution Explorer and selecting Properties.  Then on the Project Properties window click on Compile and there is were the "Build output path" is.


Wednesday, August 21, 2013 12:40 PM

Hi Darren, 

This is an ASP.NET website. In solution explorer, there is the "Solution" icon and below it the "Website" icon.

If I right click on "Solution" there is a "Properties" option. Selecting that brings me to "Common Properties" or "Configuration Properties". But there is no "Compile" option.

If I right click on "Website" icon - there is "Property Pages" option. I have the ability to select "Build" but there is no output folder.

There is MSBuild options which has an Output folder, and I set it to the root/bin location - but I don't think this is the correct place as it didn't resolve the problem. Also, the path was originally set to My Documents \ Visual Studio \ Projects \ My Project \ PrecompiledWeb ...

I was expecting to find something like     Website Folder \ Bin \ Debug


Wednesday, August 21, 2013 1:39 PM

Actually, I opened the solution as a web site - in fact it has a .csproj file - so I reopened it as a project.

Apparently, with the website you can't have the .asax code in a different file.

Thanks.


Wednesday, August 21, 2013 1:45 PM

Ah ok there is no "Build output path" for a Website Project which is your case.  The "Build output path" is only an option for Web Application Projects.