Compiler Error Message: CS0433

点点圈 提交于 2019-12-22 04:45:21

问题


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()) %>'

回答1:


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




回答2:


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.




回答3:


Context: I had a very similar problem with ASP with DevExpress and Visual Studio 2012. The problem was our \bin folder in the server was not cleared out, so there were DevExpress 's dlls of two versions v10.1 and v8.3.

Solution: I just removed the dlls files of the incorrect version and it works. Another alternative (better) is to remove all the files in that directory and put your entire folder and files of a new clear publication.




回答4:


I had this problem, to solve: Go to your project's -> References and delete "System.ComponentModel.DataAnnotations" use EntityFramework is enough. That solved my problem.




回答5:


I have a very similar problem with ASP WCF service and Visual Studio 2010 and new beta. For me helps if I edit service code file (app_code). Adding new line is enough to force VS to rebuild the page. Than this "random" error dissapears.




回答6:


Right Click on Application Name in Solution Explorer and Convert it to Web Application.



来源:https://stackoverflow.com/questions/10603680/compiler-error-message-cs0433

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!