?
Solved

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'

Posted on 2008-06-10
5
Medium Priority
?
2,403 Views
Last Modified: 2012-06-27
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\3af30b4d\App_Code.jfw1hrqs.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\f40803c9\3af30b4d\assembly\dl3\851dd24c\87bfe724_f0cac801\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.
0
Comment
Question by:purplesoup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 37

Expert Comment

by:samtran0331
ID: 21750401
>>I have tried clearing out all the temporary files
but did you clear the system cache?

go to the folder:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

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
0
 

Author Comment

by:purplesoup
ID: 21750610
Thanks for the suggestion, unfortunately I am still getting the same error.

I have cleared out all the files from
c:\WINDOWS\Microsoft.NET\Framework\v2.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\3af30b4d\assembly\dl3\702cfcf4\57168ee5_f6cac801\Test1.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\f40803c9\3af30b4d\App_Code.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>
 
0
 
LVL 37

Accepted Solution

by:
samtran0331 earned 1500 total points
ID: 21758923
Normally, clearing the server cache clears up this type of problem.
I'll have to try to recreate the issue...but is the class code you posted pretty much the whole thing?
0
 

Author Comment

by:purplesoup
ID: 21767940
Here is an example of the problem
WebPartSimple.zip
0
 

Author Closing Comment

by:purplesoup
ID: 31465691
You tried to help and gave some intelligent suggestions, even though it didn't fix the problem.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month10 days, 6 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question