C# – Compiler Error Message: CS0433

asp.netcvisual-studio-2008

I will start abruptly with a peculiar error message (I'm a beginner, building a website in ASP.NET with C#, the file where the error was found is a .ascx = user control file):

Compiler Error Message: CS0433: The type 'Link' exists in both
'…\Temporary ASP.NET Files\root\901650e7\5e27d040\App_Code.ybv-vo7n.dll' and
'…\Temporary ASP.NET Files\root\901650e7\5e27d040\assembly\dl3\f6cf02ac\a93eed1d_ab32cd01\Project1C.DLL'

Line 10 is apparently where the error stems from (colored in red). Can you give a few pointers? I'm having trouble knowing where to start looking/fixing. Thank you!

Line 9:<ItemTemplate>
Line 10:<asp:HyperLink ID="HyperLink1" runat="server" 
Line 11:NavigateUrl='<%# Link.ToFilms(Eval("FilmsID").ToString()) %>'
Line 12:Text='<%# HttpUtility.HtmlEncode(Eval("Nume").ToString()) %>'

Best Answer

I know it is a bit late for an answer, but might be of some help to someone else.

Issue: Had a similar problem with this scenario:

  • VS2010 WebAppProject (not WebSiteProject)
  • Had some isolated classes in App_Code (with property [Build Action] set to [Compile])
  • Builds successfully but when loading the web app in the browser, it throws Compilation Error CS0433: The type 'Namespace.Classname' exists in both 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\7e10b43d\77c16432\App_Code.itpfsoon.dll' and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\7e10b43d\77c16432\assembly\dl3\2055583c\0bc450de_1589ce01\ WebAppName.DLL'

Solution: Put isolated classes which require property [Build Action] set as [Compile] to any folder other than App_Code since the App_Code folder will be compiled as a separate assembly, having the same Class compiled in 2 assemblies (the App_Code and the WebApp which includes all code from the App_Code itself).

Reference: http://vishaljoshi.blogspot.com/2009/07/appcode-folder-doesnt-work-with-web.html

Related Topic