Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more: , +
I am so confused, and I don't know what I could be doing wrong.

in VS2010, I create a project with a ProjectDAL class library, another class library called ProjectCommonObjecs and another class library called ProjectBLL and fill them all with code and it all compiles. Next, I add an ASP.NET Empty Web Site to the solution, called ProjectWebSite.

Then I copy some old website into the new one using Copy Web Site... on the context menu. In its \Bin folder there was a OldWebSite.DLL file and OldWebSite.PDB file. Thing is, I wanted to join the OldWebSite's Default.asp page to the Project's Default.aspx.cs code behind.

Thing is, after the copy, i have to have the OldWebSite.DLL file in the \Bin subfolder of my new Web Site project, otherwise when I do a build, then it says

Could not load type '_Default.'

in the Error List window inside the Visual Studio environment. When I have the OldWebSite.DLL file in the \Bin folder, everything compiles fine, but then my new code-behind is ignored; if the .DLL file is missing, then there is an error.

I've searched everywhere but can't figure out where there might still be a reference to the .DLL; there's nothing in the web.config and nothing in the Default.aspx markup page. The markup page references the CodeBehind OK as far as I can tell but I may be doing something wrong.

Here's a snippet from the top of the page code:

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class="no-js">

<head id="Head1" runat="server">


If anyone has an insight for me as to what this noob is doing wrong, please feel free to share! Thanks.

Brian
Posted
Updated 15-May-18 0:45am
v2
Comments
Orcun Iyigun 22-Apr-11 18:23pm    
CodeFile="Default.aspx.cs" Inherits="_Default" if these are in your Default.aspx can you check your Default aspx.cs file, if it goes like this; public partial class _Default : System.Web.UI.Page.
Sandeep Mewara 23-Apr-11 0:58am    
Did you checked the codebehind file class name?
Brian C Hart 23-Apr-11 11:09am    
@Orc_Orc_Orc and @Sandeep: yeah everything is set correctly.

I've checked the project Property Pages,
The .cs file everything and all names are matching. That's why I am so confused.

1 solution

The solution that worked was from orc_orc_orc: Change the 'Codebehind' attribute to 'CodeFile'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900