Reputation: 220
I want to add some code into my masterpage. So I removed the namespace but when I want to test it it gives this error. No idea how to fix this.
Error 2 The namespace 'Project' in 'c:\Users\Test\AppData\Local\Temp\Temporary ASP.NET Files\project\fe95a550\6aff5a12\assembly\dl3\9f54421a\e011b011_23bccd01\Project.DLL' conflicts with the type 'Project' in 'c:\Users\Test\AppData\Local\Temp\Temporary ASP.NET Files\project\fe95a550\6aff5a12\App_Web_exfemb4u.dll' c:\Users\Test\AppData\Local\Temp\Temporary ASP.NET Files\project\fe95a550\6aff5a12\App_Web_hrdlxq5l.4.cs 154
Masterpage.cs
public partial class Project: System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Masterpage
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Project.master.cs" Inherits="Project" %>
Upvotes: 11
Views: 1335
Reputation: 1161
Change your master page's name to something other than Project . as your project's name as well as you master page are name Project. It is creating conflict.
Upvotes: 0
Reputation: 1082
Can you add a namespace before public partial ....
namespace Test
{
public partial class MovieMeter : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Why did you remove the namespace ? please add one.
Upvotes: 2
Reputation: 9370
Replace:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Project.master.cs" Inherits="Project" %>
With:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Project.master.cs" Inherits="Project" %>
It might solve...
Then the reason for the error is due to the way these two attributes are handled:
CodeBehind: Needs to be compiled before being deployed and the compiled assembly is put in the bin folder of your website.
CodeFile: You deploy the source and it is compiled as it is needed. The compiled assembly is placed in the Temporary ASP.NET folder.
Upvotes: 1