Page view counter

The type '<class>' exists in both '<dll location>' and '<dll location 2>'

Last post 06-01-2009 10:13 AM by katarukoti. 11 replies.

Sort Posts:

  • The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    04-09-2006, 11:31 PM
    • Loading...
    • JeremyThake
    • Joined on 03-12-2003, 8:43 AM
    • Perth Australia
    • Posts 16
    • Points 80
    For some reason though it appears that one of my class files (_common.cs - in the App_Code directory) is being included in the WAP .dll file as well as when it compiles the App_Code at runtime.

    error CS0433: The type 'inlinehockey._common' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\25321638\9b5c4b00\assembly\dl3\3657f4e6\cd91aef5_4d5cc601\inlinehockey.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\25321638\9b5c4b00\App_Code.xad_ajc1.dll' 


    The error was not knowing what dll to use for the type when you get the CS0433 error.

    How can I get round this error?

    Thanks
    Jeremy Thake
    www.made4the.net
  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    04-10-2006, 12:49 AM
    • Loading...
    • ScottGu
    • Joined on 06-05-2002, 8:36 PM
    • Redmond, WA
    • Posts 2,004
    • Points 13,348
    • AspNetTeam
      Moderator

    With WAP projects you want to make sure that you don't use a app_code directory, since classes within that directory will indeed get compiled twice (once in the code-behind and once at runtime) unless you explictly exclude the file from WAP project.  Try renaming the app_code directory to something else to fix it.

    BTW - this tutorial walksthrough how to migrate an existing VS 2005 Web Site Project to a VS 2005 Web Application Project: http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx

    Hope this helps,

    Scott

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    04-10-2006, 1:59 AM
    • Loading...
    • JeremyThake
    • Joined on 03-12-2003, 8:43 AM
    • Perth Australia
    • Posts 16
    • Points 80
    Thanks for the link, and for your time in helping me to fix this.

    Keep up the amazing work!

    Jeremy
  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    07-20-2007, 5:09 PM
    • Loading...
    • piyushnaik
    • Joined on 07-20-2007, 9:02 PM
    • Posts 1
    • Points 2

    I want to document for the posterity that one could get this error even if you don't have an App_Code directory but if all of the following is true:

    * You are using a Web Applications Project. (Perhaps you migrated from 1.1 like I did.)

    * You are also using a Web Deployment Project.

    * You have a "CodeFile" page directive in the some page markup instead of "CodeBehind". (How? I don't know. Could be because of certain migration issues between 1.1 and 2.0. )

    In this scenario, when MSBuild compiles the wdproj file, it compiles this page into the <Project>_deploy.dll in addition to the regular <Project>.dll. This results in duplicate class names and hence the runtime error.

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    02-01-2008, 6:20 AM
    • Loading...
    • tomtyf
    • Joined on 08-09-2007, 2:31 PM
    • Posts 6
    • Points 4

    I got this message due to the fact that I had a user control firing an event that was being handled in the parent page.

    I moved the delegate and event arg definitions into a seperate file and it solved the problem.

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    02-13-2008, 5:18 PM
    • Loading...
    • loginprompt
    • Joined on 02-13-2008, 10:15 PM
    • Posts 1
    • Points 2

    I got this from having two referneces to the same dll. I included the dll by file name once (Browse tab), and then again via the project (Projects tab) that produced the dll. Removed one of the references and all was well.

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    03-11-2008, 12:53 PM
    • Loading...
    • azote
    • Joined on 05-10-2006, 8:59 PM
    • Posts 26
    • Points 87

    thanks tomtyf......

    I moved the delegate and event arg definitions into a seperate file and it solved the problem.

    * crazy! 

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    10-14-2008, 5:18 PM

    piyushnaik:

    * You have a "CodeFile" page directive in the some page markup instead of "CodeBehind". (How? I don't know. Could be because of certain migration issues between 1.1 and 2.0. )

     This was the problem for me.  Actually, to be more specific, it was that I had BOTH a "CodeBehind" directive and a "CodeFile" directive in my page.  As an added bit of information, I was in the process of "globalizing" this particular application and I had recently used the "Generate Local Resource" tool (off the Tools menu).

     Perhaps it was in that process that the mysterious "CodeFile" directive showed up.  Anyway, now it's working and I'm happy.  Thank you piyushnaik!

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    02-04-2009, 12:47 AM
    • Loading...
    • er-v
    • Joined on 09-05-2008, 5:22 AM
    • Posts 1
    • Points 2
    Thanks so much, tomtyf! The event handler been realy the key for me. I have a user control, that is very simple. It has a dropdown inside, and I provide SelectedIndexChanged event with the folowing way.
     
     public event EventHandler SelectedIndexChanged;
            protected void ddlLocation_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (SelectedIndexChanged != null)
                {
                    SelectedIndexChanged(sender, e);
                }
            }
      I've started getting this 'The type '' exists in both '' and ''' error from time to time. After I've commented this code the problem gone. This is definitly strange. By the way I'm using .net 3.5 sp1 and I don't use App_Code folder at all. This error been happening on ASP.NET development server, and after I publish it on IIS 7 and IIS 6.
  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    04-10-2009, 2:49 AM
    • Loading...
    • Mike1298
    • Joined on 03-12-2009, 11:57 PM
    • Posts 2
    • Points 5

    Thank you for your help. I changed "CiodeFile" to "CodeBehind" in my ".aspx" file and it took care of my problem.

    Mike1298

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    06-01-2009, 10:09 AM
    • Loading...
    • katarukoti
    • Joined on 03-21-2009, 9:52 AM
    • Posts 3
    • Points 6

    hi

     when i want to publish website in vs 2005

    i am getting the below one's

    Error    1          e:\SMSPROD\DotnetCode\Registration.aspx(61): error CS0433: The type 'DotnetCode_usercontrols_Email' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_53uqcplx.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_aruiysdi.dll'            E:\SMSPROD\DotnetCode\Attendence\AttendenceMonthly.aspx         1         

     

    Error    14        The type 'DotnetCode_usercontrols_Email' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_53uqcplx.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_aruiysdi.dll'       E:\SMSPROD\DotnetCode\Registration.aspx   61       

    try to fix these issues

    Regards

    Koti

  • Re: The type '<class>' exists in both '<dll location>' and '<dll location 2>'

    06-01-2009, 10:13 AM
    • Loading...
    • katarukoti
    • Joined on 03-21-2009, 9:52 AM
    • Posts 3
    • Points 6

    hi

     when i want to publish website in vs 2005

    i am getting the below one's

    Error    1          e:\SMSPROD\DotnetCode\Registration.aspx(61): error CS0433: The type 'DotnetCode_usercontrols_Email' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_53uqcplx.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_aruiysdi.dll'            E:\SMSPROD\DotnetCode\Attendence\AttendenceMonthly.aspx         1         

     

    Error    14        The type 'DotnetCode_usercontrols_Email' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_53uqcplx.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\smsprod\a3b2710a\74e825fa\App_Web_aruiysdi.dll'       E:\SMSPROD\DotnetCode\Registration.aspx   61       

    try to fix these issues

    Regards

    Koti

Page 1 of 1 (12 items)