<div>
Hey Fellows,
Below follows issues I have encountered when copying files into my solution, clicking on the reported error or on "Go to Definition" mislead me to spot the cause. The hint is one line above..... !
I'm exposing the Problem AND how I finally Resolved it.
Errors when building the application:
- Error 1 Type 'Solution1.Web.yourABC' already defines a member called 'Page_Load' with the same parameter types C:\<folderpath>\trunk\Solution1.Web\yourABC.aspx.cs 12 24 Solution1.Web
- Error 2 Type 'Solution1.Web.yourABC' already defines a member called 'Page_Load' with the same parameter types C:\<folderpath>\trunk\Solution1.Web\GuideABT.aspx.cs 12 24 Solution1.We
How the problem arose:
I copy/pasted a file .aspx in the same solution to make a new file.
C#: Error like below started to appear; worst other misleading errors started to impact the application at runtime:
* Be aware that error 1 IS NOT an error it is CORRECT, as it is the source code
- Error 1 Type 'Solution1.Web.yourABC' already defines a member called 'Page_Load' with the same parameter types C:\<folderpath>\trunk\Solution1.Web\yourABC.aspx.cs 12 24 Solution1.Web
- Error 2 Type 'Solution1.Web.yourABC' already defines a member called 'Page_Load' with the same parameter types C:\<folderpath>\trunk\Solution1.Web\GuideABT.aspx.cs 12 24 Solution1.Web
Both classes "Page_Load" are empty, normally they are generated automatically by the Visual Studio Engine
Solution:
Change the .cs file of the newly create/pasted aspx page to reflect the page nameafter the Class "name". In this case "GuideABT.aspx" is the new pasted & renamed aspx file:
Correction on Error 1: NO CORRECTION NEEDED as it is the copied from file. MAKE SURE THAT the name of the file and the name of the class reference ARE the same in the .cs files:
File name yourABC.aspx, check the .cs extension files:
namespace Solution1.Web
{
public partial class yourABC : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Correction on Error 2: MODIFY the pasted file. Correct the CLASS NAME to reflect the name of the .aspx file.
File name GuideABT.aspx, check the .cs extension files:
ORIGINAL code in .cs
namespace Solution1.Web
{
public partial class yourABC : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
CORRECTED this code in .cs TO
namespace FEUnicenter.Web
{
public partial class GuideABT : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Issue RESOLVED.
Cheers.
</div>