Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiler Error Message: CS0433

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()) %>'
like image 903
Anna T Avatar asked May 15 '12 15:05

Anna T


2 Answers

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

like image 84
mrd3650 Avatar answered Sep 19 '22 04:09

mrd3650


You will have a path similar to the following:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

Delete the contents of this entire folder (no harm will be done), then try and Clean and Rebuild your solution.

like image 31
Barry Kaye Avatar answered Sep 19 '22 04:09

Barry Kaye