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

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?

Jeremy Thake
4/10/2006 3:31:21 AM 1239 articles. 0 followers. Follow

9 Replies

Similar Articles

[PageSpeed] 8
Get it on Google Play
Get it on Apple App Store

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:

Hope this helps,


4/10/2006 4:49:45 AM
Thanks for the link, and for your time in helping me to fix this. 

Keep up the amazing work!

4/10/2006 5:59:59 AM

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.

7/20/2007 9:09:09 PM

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.

2/1/2008 11:20:59 AM

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.

2/13/2008 10:18:25 PM

thanks tomtyf......

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

* crazy! 

3/11/2008 4:53:14 PM


* 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!

10/14/2008 9:18:52 PM
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.
2/4/2009 5:47:25 AM

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


4/10/2009 6:49:31 AM

Similar Artilces:

Give access to non virtual folder through configuration entry? ERROR: <location> path attribute must be a relative virtual path. It cannot contain any of '?' ':' '\' '*' '"' '<' '>' or '|'.
I have a webpage running under a virtual directory that is mapped to d:/webapplication that produces an excel spreadsheet, the page calls a library object that generates a report and places it in a folder d:/attachments. This folder is not in the virtual directory. When I access the webpage i click a button and it attemps to return the created spreadsheet as a mim content type application/ However i getting redirected back to the login page of the application. Ive also noticed that the excel spreadsheet has not even been created at this location. So assuming this...

Migration Issue. (The type '<component type>' exists in both <file1.dll> and <file2.dll>)
The type 'CrystalDecisions.CrystalReports.Engine.ReportDocument' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\10.2.3600.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll' and 'c:\WINDOWS\assembly\GAC\CrystalDecisions.CrystalReports.Engine\10.0.3300.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll'    D:\Limewise\Research\pbk2005\App_Code\ui\CRReportDocument.cs    10    103    D:\...\pbk2005\...

DetailsView Converts '<' & '>' to '&lt;' & '&gt;'
I have multi-line textboxes from which the data is stored as a text value in the SQL database. Before the data is passed to the stored procedure, the text is parsed to replace all vbNewLIne and vbLf cases with "<br/>". This is done successfully, storing the text in the database with the "<br/>" tags. When the data is displayed, I want the text data dropped into the page as is; meaning "<br/>" in the database appears as "<br/>" in the source. However, the DetailsView object into which the values are being passed seems to be trans...

'<name>' is not a member of '<classname>'
I am posting this question as I am unsure how to proceed. I recently migrated a web project from .net 2003 to 2005. I have been able to work out most of the issues, but, unfortunaltely I am left with a few I do not understand. The error shows Error 17 'ddlQualSource' is not a member of 'CwMerge.ucFileUpload'. When I look for the object which is DropDownList it exists on a web form. The only 2 references to this object is in the HTML and the code below showing when it is loading with data. What I need to do is use the users selection later on in the project on a different web f...

Allowing '->' and '=>' in C<...>
On Tue, Jan 25, 2000 at 12:03:51AM -0500, Ronald J Kimball wrote: > I'm concerned that someone may find another exception, and then another, > and then another, and soon POD parsing becomes extremely complicated. Too late - thats already the case with special-handling -> and => inside of C<...>. It won't get significantly more or less complicated by limiting what can appear to the left of [-=]>. In fact its more likely to make the code less complicated. > > its not enough to simply be '->' or '=>', perhaps we only want to allo...

problem with updating the <meta> 'description' and 'keywords' and <title></title> in masterpage from textbox in formview,
I have a slight problem with updating the <meta> 'description and keywords' and <title></title>  in masterpage from formview, as i am calling the textbox values from a access db.the formview resides in a page that has a masterpage. masterPages <meta> and <title> updated by textbox in formview doesnt work but when outside the 'formview' it works finemy Page_Load (......) is as follows.     {    Page.Header.Title = TextBox3.Text;        HtmlMeta meta = new HtmlMeta(); &...

bug: Cannot convert 'T1<T>::T2<0>' to 'T1<int>::T2<0>
I have bug in this code (C++ Builder 2010 Update 5): template <class T> class T1 { public: template <bool b> class T2 { public: // T2() {} // T2(const T2 &Value) {} }; typedef T2<false> T3; T3 f() const {return T3(); } }; int _tmain(int argc, _TCHAR* argv[]) { typedef T1<int> T4; T4 c; T4::T3 i = c.f(); //T4::T3 i; T4::T3 j = i; } [BCC32 Error] Test.cpp(29): E2034 Cannot convert 'T1<T>::T2<0>' to 'T1<int>::T2<0>' in line T4::T3 i = c.f(); ...

SqlBulkCopy: the locale id '0' of the source column '<column name> ' and the locale id '1033' of the destination column '<column name>' do not match.
Hi, I am using the sqlbulkcopy object to transfer large amount of data from one SQL server to Other. The code look like this.. SqlDataReader readerSrc = null;SqlBulkCopy bulkCopy = new SqlBulkCopy(connDest);//Prepare Destination Table.SqlCommand cmdDelete = new SqlCommand("DELETE FROM " + destTableName, connDest);//Set the sqlcommand textSqlCommand cmdGet = new SqlCommand("SELECT * FROM " + srcTableName, connSrc);//Open source connection.connSrc.Open();//Open destination connection.connDest.Open();int delete = cmdDelete.ExecuteNonQuery();//Get the data.readerSrc = cmdGet.ExecuteRead...

C# and Linq --> Operator '>=' cannot be applied to operands of type 'int' and 'System.Linq.IQueryable<int?>
 Hi, I'm pretty new to the world of programming, but i tried searching the web after an answar but keeps coming up empty. So, I'm stuck. So, the school assignment is to build a booking-application for a hotel. At the moment, it just consists of two calendars (end date/start date), two dropdownlists (how many beds/extra beds) and a submit button. This is where I am at the moment: --------- start of code------------------    protected void Button1_Click(object sender, EventArgs e)    {        DataClass...

[perl6/specs] a455b1: old <a>**',' is now written <a>+%','
Branch: refs/heads/master Home: Commit: a455b11b2c4364014f34401d41001a0fa3628e3d Author: Larry Wall <> Date: 2011-09-20 (Tue, 20 Sep 2011) Changed paths: M S05-regex.pod Log Message: ----------- old <a>**',' is now written <a>+%',' The separator syntax is now required to be a modifier on a quantifier, so the old <a> ** ',' is now written <a>+ % ','. This allo...

Handling of '>>>' and '-- '
Hi all, A couple of queries: 1) Is there a way to STOP Thunderbird from indenting replies with >>>>>>'s in e-mail (but not newsgroups)? 2) Is there a way to STOP Thunderbird from deleting everything that comes after a '-- ' on reply? If the answer is no, what'd be the best way to go about getting these 'features' added? Cheers, Cyker none wrote: > Hi all, > > A couple of queries: > 1) Is there a way to STOP Thunderbird from indenting replies with >>>>>>'s in e-mail (but not newsgroups)? > >...

Why Response.Write("<script>"newWind.aspx','report','');</script>") not working?
I need to open a new web browser of url=newWind.aspx and tried the code below; Response.Write("<script>'newWind.aspx','report','');</script>")However nothing happens, what can I do to make it work? Try RegisterClientScriptBlock("OpenWin","<script language=javascript>'newWind.aspx','report','');</script>")I think that is the name of it...Also look at RegisterStartupScriptBlock (I think)MajorCats Thanks. But, it was same difference. Is there anything that blocks the new browser from showing up in the setting of IE or system?   &nbs...

Cannot implicitly convert type 'System.Collections.ObjectModel.Collection<SQLServerDAL.Product>' to 'System.Collections.ObjectModel.Collection<BLL.Product>'
Here is my GetProducts method in the BLL   public static Collection<Product> GetProducts() {     return SQLServerDAL.Product.GetProducts(); }   which calls the GetProducts method in the DAL   public static Collection<Product> GetProducts() {       try        {             //Invoke a SQL command             using (IDataReader dataReader = db.ExecuteReader(CommandType.StoredP...

Web resources about - The type '<class>' exists in both '<dll location>' and '<dll location 2>' -

Resources last updated: 12/1/2015 3:05:48 PM