tags:

views:

69

answers:

4

Hello, i've create an asp dot net application. i try to deploy it using a Web Setup Project. but when i istall it i get this 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 'WebApplication2._Default'.

Source Error:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>

what's the wrong here ?? how can i solve it. some probleme when i creat a new umpty application.!!!!

namespace WebApplication2 { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } }

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %

I haven't change the name i let evry thing by default but it dosen't work??

+3  A: 

Did you change the name of your code behind class for Default.aspx.cs? If so, that doesn't get automatically reflected in your Default.aspx file. You have to change that manually.

Just a guess - but that's where I'd look first.

EDIT (some add'l info): I just tested it out, and if I change the class name in Default.aspx.cs AND Default.aspx.designer.cs, I get the error in the original question. (Thanks for the comment!!) I think that's the problem.

I can have this happen also if I rename the code behind class and use the refactor option to change 'Default' to 'FooBar', for example. It renames the code behind and designer, but doesn't update the aspx page. I'm using VS2008.

So change your aspx page's Inherit's attribute from _Default to your new class name.

David Hoerster
Also check the Default.aspx.designer.cs This contains a partial implementation of the same class.
Daniel Dyson
It could also be a changed namespace.
recursive
i didn't change the name of code behind i don't understand what's the problem here?
it'work's when i run it but when i install it i'v the errors
A: 

Your files should look like this below, also make sure your output folder you deploy to is clean. If you deployed before with a different namespace...etc you could have old dlls and or .aspx files lingering.

Default.aspx:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" 
    Inherits="WebApplication2._Default" %>

Default.aspx.cs:

namespace WebApplication2
{
    public partial class _Default : System.Web.UI.Page
    {
        //...
    }
}
rick schott
how can i solve that?
Right click on your project and click "Clean", also delete all your filed in the bin directory if they exist. If you are deploying to different directory, delete all the files before you publish.
rick schott
You can also delete all your temp asp.net files here, stop IIS first: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
rick schott
even if it's a new project? i mean it's the first installation? it gives this pb. i'v the same pb is it cause i use vs2008 ??
Read up on asp.net compilation here: Compilation and Deployment in ASP.NET 2.0 - http://www.west-wind.com/presentations/AspNetCompilation/AspNetCompilation.asp
rick schott
A: 

You get this error message when the assemblies linked to the application do not contain the _Default class. This is caused by the codebehind file having errors that prevent it compiling.

Also make sure that you are including the primary output in your setup project.

Philip Smith
A: 

That's it i didn't include the primary output. Thanks

clunin