CS1595 ‘…’ is defined in multiple places error when you use a user control

less than 1 minute read

CS1595: '_ASP.FormsLoginPart_ascx' is defined in multiple places; using definition from 'c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\recruitment_selfservice\858213b9\9a24bb64\tyrklreb.dll'

I have this error often, because some .net webcontrols have the same file name, though they belong to different namespaces. I googled this a little bit and there are a few solutions.

  • change webcontrol .ascx name. asp.net compiler does not like same webcontrol file name.
    ex) AnotherCurrentDate.ascx
  • use classname attribute in control directive
    ex) <%@ Control Language="c#" AutoEventWireup="false" Codebehind="CurrentDate.ascx.cs" Classname="AnotherCurrentDate" Inherits="MyProj.CurrentDate" %>

The idea is from velocity reviews thread