purplesoup
asked on
The type 'WebPartTests.Test1' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\...\Weather.DLL' and 'c:\WINDOWS\...\App_Code.ukqokk-6.dll'
I am trying to run a web part on my web page using a class file.
The class file is in the App_Code folder and just inherts from the WebPart class:
namespace WebPartTests
{
public class Test1 : WebPart
{
public Test1() { }
protected override void Render(HtmlTextWriter writer)
{
writer.Write("hello");
base.Render(writer);
}
}
}
This should display on the default.aspx page:
<%@ Register TagPrefix="wp" Namespace="WebPartTests" %>
...
<asp:WebPartZone ID="WebPartZone1" runat="server">
<ZoneTemplate>
<wp:Test1 id="TestPart1" runat="server" Title="Web Part Test" />
</ZoneTemplate>
</asp:WebPartZone>
However although it builds ok, when I run it I get the following error:
Compiler Error Message: CS0433: The type 'WebPartTests.Test1' exists in both 'c:\WINDOWS\Microsoft.NET\ Framework\ v2.0.50727 \Temporary ASP.NET Files\root\f40803c9\3af30b 4d\App_Cod e.jfw1hrqs .dll' and 'c:\WINDOWS\Microsoft.NET\ Framework\ v2.0.50727 \Temporary ASP.NET Files\root\f40803c9\3af30b 4d\assembl y\dl3\851d d24c\87bfe 724_f0cac8 01\Weather .DLL'
I have tried clearing out all the temporary files, and changing the batch property for compilation in the web.config file.
What else can I try?
Note this really is just a default.aspx web page and a Test1.cs class file project - there is very little to it.
The class file is in the App_Code folder and just inherts from the WebPart class:
namespace WebPartTests
{
public class Test1 : WebPart
{
public Test1() { }
protected override void Render(HtmlTextWriter writer)
{
writer.Write("hello");
base.Render(writer);
}
}
}
This should display on the default.aspx page:
<%@ Register TagPrefix="wp" Namespace="WebPartTests" %>
...
<asp:WebPartZone ID="WebPartZone1" runat="server">
<ZoneTemplate>
<wp:Test1 id="TestPart1" runat="server" Title="Web Part Test" />
</ZoneTemplate>
</asp:WebPartZone>
However although it builds ok, when I run it I get the following error:
Compiler Error Message: CS0433: The type 'WebPartTests.Test1' exists in both 'c:\WINDOWS\Microsoft.NET\
I have tried clearing out all the temporary files, and changing the batch property for compilation in the web.config file.
What else can I try?
Note this really is just a default.aspx web page and a Test1.cs class file project - there is very little to it.
ASKER
Thanks for the suggestion, unfortunately I am still getting the same error.
I have cleared out all the files from
c:\WINDOWS\Microsoft.NET\F ramework\v 2.0.50727\ Temporary ASP.NET Files\
I have deleted all the files in the bin and obj subfolders.
I have renamed the assembly it builds.
I am still getting the same problem:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'WebPartTests.Test1' exists in both 'c:\WINDOWS\Microsoft.NET\ Framework\ v2.0.50727 \Temporary ASP.NET Files\root\f40803c9\3af30b 4d\assembl y\dl3\702c fcf4\57168 ee5_f6cac8 01\Test1.D LL' and 'c:\WINDOWS\Microsoft.NET\ Framework\ v2.0.50727 \Temporary ASP.NET Files\root\f40803c9\3af30b 4d\App_Cod e.mrmi744b .dll'
Source Error:
Line 15: <asp:WebPartZone ID="WebPartZone1" runat="server">
Line 16: <ZoneTemplate>
Line 17: <wp:Test1 id="TestPart1" runat="server" Title="Web Part Test" />
Line 18: </ZoneTemplate>
Line 19: </asp:WebPartZone>
I have cleared out all the files from
c:\WINDOWS\Microsoft.NET\F
I have deleted all the files in the bin and obj subfolders.
I have renamed the assembly it builds.
I am still getting the same problem:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'WebPartTests.Test1' exists in both 'c:\WINDOWS\Microsoft.NET\
Source Error:
Line 15: <asp:WebPartZone ID="WebPartZone1" runat="server">
Line 16: <ZoneTemplate>
Line 17: <wp:Test1 id="TestPart1" runat="server" Title="Web Part Test" />
Line 18: </ZoneTemplate>
Line 19: </asp:WebPartZone>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Here is an example of the problem
WebPartSimple.zip
WebPartSimple.zip
ASKER
You tried to help and gave some intelligent suggestions, even though it didn't fix the problem.
but did you clear the system cache?
go to the folder:
c:\WINDOWS\Microsoft.NET\F
and delete everything in it (you might have to stop IIS and close Visual Studio first).
everytime you debug/build, the dll's and compiled code get thrown in there, if you don't clear that folder out occasionally (I do it at least 2x every day while coding) you will get these kind of errors