在预编译的ASP.NET 2.0站点上编译错误CS0433

时间:2020-12-10 13:57:37

I keep getting this error ever so often when I launch the debugger to debug my site. I'm using the Telerik controls, and usually the error is in my tab strip. Here is an example of the error I'm looking at right now:

当我启动调试器来调试我的站点时,我经常会遇到这个错误。我正在使用Telerik控件,通常错误在我的标签条中。以下是我正在查看的错误示例:

Compiler Error Message: CS0433: The type 'ASP.controls_motorvehiclegeneral_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_6wlqh1iy.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_ro_sgchs.dll'

Source Error:

Line 48:     </telerik:RadTabStrip>
Line 49:     <telerik:RadMultiPage ID="RadMultiPageControls" Runat="server" SelectedIndex="0">
Line 50:     <telerik:RadPageView ID="PageGeneral" runat="server"><uc1:General ID="GeneralControl" runat="server" /></telerik:RadPageView>
Line 51:     <telerik:RadPageView ID="PageVehicle" runat="server"><uc1:VehicleList ID="VehicleList" runat="server" /></telerik:RadPageView>
Line 52:     <telerik:RadPageView ID="PagePerson" runat="server"><uc1:PersonList ID="PersonList" runat="server" /></telerik:RadPageView>

The thing that bothers me most, is if I just keep hitting F5, the page WILL refresh and work as it should. Sometimes it takes several refreshes to do this, others it happens pretty quick. I have not been able to find a solution on the net, as most of the people with this error are upgrading from VS2005 to Web Application, and thus the fix seems to be "Remove your app_code directory, and change the CodeFile= to CodeBehind=. But, the CodeBehind is old, and not used anymore.

最困扰我的是,如果我只是继续按F5,页面将刷新并按预期工作。有时需要多次刷新才能完成此操作,有些则需要很快才能完成。我无法在网上找到解决方案,因为大多数有此错误的人正在从VS2005升级到Web应用程序,因此修复似乎是“删除您的app_code目录,并将CodeFile =更改为CodeBehind =但是,CodeBehind已经过时了,不再使用了。

In this instance, I'm getting the error on my General tab, but it can happen of ANY of my user controls when it DOES happen.

在这种情况下,我在“常规”选项卡上收到错误,但是当它发生时,可能会发生任何用户控件。

Has anyone else seen this with pre-compiled pages? I'm using VS2008 SP1.

有没有其他人用预编译的页面看过这个?我正在使用VS2008 SP1。

The other effect I've seen related to this is when I have a GridView setup with a datasource, and the datasource changes, but the page does not update until several other operations, then all at once all the data is filled in... This makes me think there is some sort of cache issue, or compile-time, time-out or something...

我看到的与此相关的另一个影响是当我有一个带有数据源的GridView设置,并且数据源发生了变化,但是在几个其他操作之前页面不会更新,然后所有数据都被填充...这让我觉得存在某种缓存问题,或者编译时,超时或者什么......

I am using a site.master page, and have checked the @Page and @Master directives... Just for the sake of argument, here are the compiler options it's using...

我正在使用site.master页面,并检查了@Page和@Master指令...仅仅为了参数,这里是它使用的编译器选项...

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE> "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\6614ff9a\005164fc_423cc801\PetersDatePackage.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.Common.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_0-em44qa.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_6wlqh1iy.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_ro_sgchs.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Build.Utilities\2.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Utilities.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\6fe979bb\0056bc44_4b94c701\Microsoft.Practices.EnterpriseLibrary.Common.DLL" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\ad70f8ed\0010f920_4b94c701\Microsoft.Practices.EnterpriseLibrary.Data.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\d61e8194\009ae0bd_854ec901\Telerik.Web.UI.DLL" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\98ba2ae7\211fb135_e674c901\CoreAPI.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\1.0.61025.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Management\2.0.0.0__b03f5f7f11d50a3a\System.Management.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\62fa267e\9888875e_bb5cc901\AjaxControlToolkit.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.Build.Framework\2.0.0.0__b03f5f7f11d50a3a\Microsoft.Build.Framework.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Code.nufffrfb.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\52f6447d\f90fd1c8_b475c901\StatisticsAPI.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\955f38e7\982cdc0f_bc5cc901\Validators.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_nv7t8gs_.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Design\2.0.0.0__b03f5f7f11d50a3a\System.Design.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\assembly\dl3\a5daf5e0\0071b5e7_909cc701\Microsoft.Practices.ObjectBuilder.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.ProcessingObjectModel.dll" /R:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_atcckswk.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /out:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_zva2jsmk.dll" /D:DEBUG /debug+ /optimize- /win32res:"c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\zva2jsmk.res" /nowarn:1659;1699;1701 /d:DBCONVERTPUBLIC;CRYSTALSUPPORT  "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_zva2jsmk.0.cs" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_zva2jsmk.1.cs" "c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\statisticsweb\30c716d3\eebad209\App_Web_zva2jsmk.2.cs"

Anyone have any ideas where I can even start to look?

任何人都有任何想法,我甚至可以开始看?

10 个解决方案

#1


7  

killing Cassini instances as above didn't work for me. ScottGu posted about this issue

如上所述杀死卡西尼实例并不适合我。 ScottGu发布了这个问题

setting the batch="false" attribute on the compilation section in web.config worked for me.

在web.config的编译部分设置batch =“false”属性对我有用。

<configuration>

   <system.web>
       <compilation debug="false" batch="false"></compilation>
   </system.web>

</configuration>

This tells ASP.NET to dynamically compile individual .aspx/.ascx files into separate assemblies. This avoids the circular reference issue that triggers the exception.

这告诉ASP.NET将各个.aspx / .ascx文件动态编译为单独的程序集。这避免了触发异常的循环引用问题。

#2


1  

For me, closing the IDE, shutting the web site (IIS or Cassini), deleting all of my temporary asp.net files, launching the IDE and doing a full compile does the trick.

对我来说,关闭IDE,关闭网站(IIS或Cassini),删除所有临时asp.net文件,启动IDE并进行完整编译就可以了。

#3


1  

in IIS you need to restart it by opening the command prompt and typing iisreset then hit enter, however if your using the build in Visual Studio web server (Cassini) then this wont solve your problem. You can terminate all running Cassini instances by typing (exactly like this because its Case Sensitive): taskkill /f /im "WebDev.WebServer.exe" and hitting enter. You will then see the following message: SUCCESS: The Process "WebDev.WebServer.EXE" with PID <some #> has been terminated.

在IIS中,您需要通过打开命令提示符并键入iisreset然后按Enter键重新启动它,但是如果您在Visual Studio Web服务器(Cassini)中使用构建,那么这不会解决您的问题。您可以通过键入(因为它区分大小写)来终止所有正在运行的Cassini实例:taskkill / f / im“WebDev.WebServer.exe”并按Enter键。然后,您将看到以下消息:SUCCESS:已终止具有PID 的进程“WebDev.WebServer.EXE”。 #>

#4


1  

If you have VS2008 and a WEB Application (not WEB Site) you can't have directory named App_Code (you must remove all files from it an move it forexam. to Root folder) and delete/exclude from project that folder (App_Code). Every file you have in App_Code will be compiled during DEBUG/Publish. - this solved my problem with CS0433.

如果您有VS2008和WEB应用程序(不是WEB站点),则不能有名为App_Code的目录(您必须从中移除所有文件,将其移至根文件夹)并从项目文件夹(App_Code)中删除/排除。 App_Code中的每个文件都将在DEBUG / Publish期间编译。 - 这解决了CS0433的问题。

#5


1  

I recently fixed that error. The cause is because there are some files or classes declared more than one time in the project. In my case,

我最近解决了这个错误。原因是因为在项目中有一些文件或类被声明了多次。就我而言,

error CS0433: The type 'usercontrol_ucManageNews' exists in both 
'c:\Users\DangLe\AppData\Local\Temp\Temporary ASP.NET Files\working\ed64f624\95e2038d\App_Web_kc2c2twy.dll' and 'c:\Users\DangLe\AppData\Local\Temp\Temporary ASP.NET Files\working\ed64f624\95e2038d\App_Web_0ywfoitp.dll'

because in my project there are two folders containing file ucManageNews.ascx

因为在我的项目中有两个文件夹包含文件ucManageNews.ascx

#6


0  

The cause MIGHT be that some other DLL's you are referencing might be referencing the older/newer version of the specified assembly. So different parts of the app are referencing different versions of the assembly. I ran into an issue like this as well. In order to resolve it, I forced the app to use the new version:

原因可能是您引用的其他一些DLL可能引用了指定程序集的旧版本/更新版本。因此应用程序的不同部分引用了不同版本的程序集。我遇到了这样的问题。为了解决它,我强迫应用程序使用新版本:

I changed all of my references in the web.config to point to the newer version. In my case it was the System.Web.Extensions assembly that was causing problems. I changed all of them from 1.0.60125.0 to 3.5.0.0

我在web.config中更改了所有引用以指向较新的版本。在我的情况下,导致问题的是System.Web.Extensions程序集。我将所有这些从1.0.60125.0更改为3.5.0.0

Next, I added these lines to my web.config, which basically tells your application to "forward" all references to the old version of the assembly, to the new one:

接下来,我将这些行添加到我的web.config中,它基本上告诉你的应用程序将所有对旧版程序集的引用“转发”到新版本:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;sitefinity\admin\bin" />
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Security" publicKeyToken="dfeaee0e3978ac79" />
        <bindingRedirect oldVersion="3.2.1598.2" newVersion="3.5.1747.2" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Cms.Web.UI" publicKeyToken="dfeaee0e3978ac79" />
        <bindingRedirect oldVersion="3.2.1598.2" newVersion="3.5.1747.2" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
        <bindingRedirect oldVersion="2008.1.515.20" newVersion="2008.2.1001.20" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

I did not come up with this solution, but found it somewhere that I can't remember. However, I don't think I've ever seen an explanation of exactly why this happens either!

我没有提出这个解决方案,但发现它在某个我不记得的地方。但是,我认为我从来没有看到过为什么会发生这种情况的解释!

#7


0  

I just had this problem. It turns out that, I accidentally drag-&-dropped files from one project to another, which created a duplicate. It took me a while to find the problem, because the files were hidden within the Properties folder (which I never look into).

我刚遇到这个问题。事实证明,我不小心将文件从一个项目拖放到另一个项目,这创建了一个副本。我花了一段时间才发现问题,因为文件隐藏在Properties文件夹中(我从未查看过)。

In any case, what helped me solve the problem was going into the file that was throwing the error, r-clicking on the erroneous line and "going to definition". Being in the definition, you can see which physical file you are looking at. If it isn't what it is supposed to be, then you found your problem.

在任何情况下,帮助我解决问题的是进入抛出错误的文件,点击错误的行并“转到定义”。在定义中,您可以看到您正在查看的物理文件。如果它不是它应该是什么,那么你找到了你的问题。

I know this is trivial, but it wasted me around 1 hour of time, so hope this info would be useful to anyone.

我知道这是微不足道的,但它浪费了我大约1小时的时间,所以希望这些信息对任何人都有用。

#8


0  

To fix this bug, it's fairly simple, but requires some rarely used declarations (hard part was digging through the right documentation ;).

要修复这个错误,它很简单,但需要一些很少使用的声明(困难的部分是通过正确的文档挖掘;)。

See ECMA-334, Section, 16.3 "Extern alias directives"

参见ECMA-334,第16.3节“外部别名指令”

If you control "your" source and are linking to another assembly "their" binary, yet you can not change (or do not want too change:) the namespace/type specifiers (e.g. BOTH of you declare System). I actually ran into this a fair amount lately, with all the Beta/Alpha/Version updates to the CLR/DLR, MS has been churning a lot in their published namespace's.

如果您控制“您的”源并链接到另一个程序集“他们的”二进制文件,但您无法更改(或不希望太多更改:)命名空间/类型说明符(例如,您声明系统的两个)。实际上我最近遇到了相当多的问题,对CLR / DLR进行了所有Beta / Alpha /版本的更新,MS在他们发布的命名空间中进行了大量的研究。

When you import assembly "their", typically the compiler will set it up into the global (reserved) namespace. In MSVC, you go to properties on the assembly reference, go to where it say's "Aliases", you can then specify a new name, other than global. Or actually a few names.

导入程序集“its”时,编译器通常会将其设置为全局(保留)命名空间。在MSVC中,您转到程序集引用的属性,转到它所说的“别名”的位置,然后您可以指定除全局之外的新名称。或者实际上是几个名字。

Let's say you use the imaginative name of "global2".

假设您使用富有想象力的名称“global2”。

You then goto your source files and at the TOP before any namespace declarations, you place;

然后,您可以在任何名称空间声明之前转到源文件并在TOP处放置;

extern alias global2;
using global2::System;

Your code can then use the types from global2, like "Int32" or whichever, you can still rename it via;

然后,您的代码可以使用global2中的类型,如“Int32”或其中任何一种,您仍然可以通过它重命名;

extern alias global2;
using global2::System;
using orig = System;

#9


0  

btw, CodeBehind isn't old and not used!

顺便说一句,CodeBehind不老,不用!

CodeBehind= is for pages in Web Application (with .Designer.cs files) and CodeFile= is for page in Web Site (dynamically compiled assemblies so without .Designer.cs files)

CodeBehind =用于Web应用程序中的页面(带有.Designer.cs文件),CodeFile =用于Web站点中的页面(动态编译的程序集,因此没有.Designer.cs文件)

#10


0  

I had this issue today with a Web USer Control but discovered that changing CodeBehind="..." to Src="..." is the cause of the error. [link]http://stevenoderayi.blogspot.com/2011/04/resolved-cs0433-type-user-control.html[/link]

我今天在Web USer Control中遇到过这个问题,但发现将CodeBehind =“...”更改为Src =“...”是导致错误的原因。 [链接] http://stevenoderayi.blogspot.com/2011/04/resolved-cs0433-type-user-control.html [/链接]

#1


7  

killing Cassini instances as above didn't work for me. ScottGu posted about this issue

如上所述杀死卡西尼实例并不适合我。 ScottGu发布了这个问题

setting the batch="false" attribute on the compilation section in web.config worked for me.

在web.config的编译部分设置batch =“false”属性对我有用。

<configuration>

   <system.web>
       <compilation debug="false" batch="false"></compilation>
   </system.web>

</configuration>

This tells ASP.NET to dynamically compile individual .aspx/.ascx files into separate assemblies. This avoids the circular reference issue that triggers the exception.

这告诉ASP.NET将各个.aspx / .ascx文件动态编译为单独的程序集。这避免了触发异常的循环引用问题。

#2


1  

For me, closing the IDE, shutting the web site (IIS or Cassini), deleting all of my temporary asp.net files, launching the IDE and doing a full compile does the trick.

对我来说,关闭IDE,关闭网站(IIS或Cassini),删除所有临时asp.net文件,启动IDE并进行完整编译就可以了。

#3


1  

in IIS you need to restart it by opening the command prompt and typing iisreset then hit enter, however if your using the build in Visual Studio web server (Cassini) then this wont solve your problem. You can terminate all running Cassini instances by typing (exactly like this because its Case Sensitive): taskkill /f /im "WebDev.WebServer.exe" and hitting enter. You will then see the following message: SUCCESS: The Process "WebDev.WebServer.EXE" with PID <some #> has been terminated.

在IIS中,您需要通过打开命令提示符并键入iisreset然后按Enter键重新启动它,但是如果您在Visual Studio Web服务器(Cassini)中使用构建,那么这不会解决您的问题。您可以通过键入(因为它区分大小写)来终止所有正在运行的Cassini实例:taskkill / f / im“WebDev.WebServer.exe”并按Enter键。然后,您将看到以下消息:SUCCESS:已终止具有PID 的进程“WebDev.WebServer.EXE”。 #>

#4


1  

If you have VS2008 and a WEB Application (not WEB Site) you can't have directory named App_Code (you must remove all files from it an move it forexam. to Root folder) and delete/exclude from project that folder (App_Code). Every file you have in App_Code will be compiled during DEBUG/Publish. - this solved my problem with CS0433.

如果您有VS2008和WEB应用程序(不是WEB站点),则不能有名为App_Code的目录(您必须从中移除所有文件,将其移至根文件夹)并从项目文件夹(App_Code)中删除/排除。 App_Code中的每个文件都将在DEBUG / Publish期间编译。 - 这解决了CS0433的问题。

#5


1  

I recently fixed that error. The cause is because there are some files or classes declared more than one time in the project. In my case,

我最近解决了这个错误。原因是因为在项目中有一些文件或类被声明了多次。就我而言,

error CS0433: The type 'usercontrol_ucManageNews' exists in both 
'c:\Users\DangLe\AppData\Local\Temp\Temporary ASP.NET Files\working\ed64f624\95e2038d\App_Web_kc2c2twy.dll' and 'c:\Users\DangLe\AppData\Local\Temp\Temporary ASP.NET Files\working\ed64f624\95e2038d\App_Web_0ywfoitp.dll'

because in my project there are two folders containing file ucManageNews.ascx

因为在我的项目中有两个文件夹包含文件ucManageNews.ascx

#6


0  

The cause MIGHT be that some other DLL's you are referencing might be referencing the older/newer version of the specified assembly. So different parts of the app are referencing different versions of the assembly. I ran into an issue like this as well. In order to resolve it, I forced the app to use the new version:

原因可能是您引用的其他一些DLL可能引用了指定程序集的旧版本/更新版本。因此应用程序的不同部分引用了不同版本的程序集。我遇到了这样的问题。为了解决它,我强迫应用程序使用新版本:

I changed all of my references in the web.config to point to the newer version. In my case it was the System.Web.Extensions assembly that was causing problems. I changed all of them from 1.0.60125.0 to 3.5.0.0

我在web.config中更改了所有引用以指向较新的版本。在我的情况下,导致问题的是System.Web.Extensions程序集。我将所有这些从1.0.60125.0更改为3.5.0.0

Next, I added these lines to my web.config, which basically tells your application to "forward" all references to the old version of the assembly, to the new one:

接下来,我将这些行添加到我的web.config中,它基本上告诉你的应用程序将所有对旧版程序集的引用“转发”到新版本:

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;sitefinity\admin\bin" />
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Security" publicKeyToken="dfeaee0e3978ac79" />
        <bindingRedirect oldVersion="3.2.1598.2" newVersion="3.5.1747.2" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Cms.Web.UI" publicKeyToken="dfeaee0e3978ac79" />
        <bindingRedirect oldVersion="3.2.1598.2" newVersion="3.5.1747.2" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" />
        <bindingRedirect oldVersion="2008.1.515.20" newVersion="2008.2.1001.20" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

I did not come up with this solution, but found it somewhere that I can't remember. However, I don't think I've ever seen an explanation of exactly why this happens either!

我没有提出这个解决方案,但发现它在某个我不记得的地方。但是,我认为我从来没有看到过为什么会发生这种情况的解释!

#7


0  

I just had this problem. It turns out that, I accidentally drag-&-dropped files from one project to another, which created a duplicate. It took me a while to find the problem, because the files were hidden within the Properties folder (which I never look into).

我刚遇到这个问题。事实证明,我不小心将文件从一个项目拖放到另一个项目,这创建了一个副本。我花了一段时间才发现问题,因为文件隐藏在Properties文件夹中(我从未查看过)。

In any case, what helped me solve the problem was going into the file that was throwing the error, r-clicking on the erroneous line and "going to definition". Being in the definition, you can see which physical file you are looking at. If it isn't what it is supposed to be, then you found your problem.

在任何情况下,帮助我解决问题的是进入抛出错误的文件,点击错误的行并“转到定义”。在定义中,您可以看到您正在查看的物理文件。如果它不是它应该是什么,那么你找到了你的问题。

I know this is trivial, but it wasted me around 1 hour of time, so hope this info would be useful to anyone.

我知道这是微不足道的,但它浪费了我大约1小时的时间,所以希望这些信息对任何人都有用。

#8


0  

To fix this bug, it's fairly simple, but requires some rarely used declarations (hard part was digging through the right documentation ;).

要修复这个错误,它很简单,但需要一些很少使用的声明(困难的部分是通过正确的文档挖掘;)。

See ECMA-334, Section, 16.3 "Extern alias directives"

参见ECMA-334,第16.3节“外部别名指令”

If you control "your" source and are linking to another assembly "their" binary, yet you can not change (or do not want too change:) the namespace/type specifiers (e.g. BOTH of you declare System). I actually ran into this a fair amount lately, with all the Beta/Alpha/Version updates to the CLR/DLR, MS has been churning a lot in their published namespace's.

如果您控制“您的”源并链接到另一个程序集“他们的”二进制文件,但您无法更改(或不希望太多更改:)命名空间/类型说明符(例如,您声明系统的两个)。实际上我最近遇到了相当多的问题,对CLR / DLR进行了所有Beta / Alpha /版本的更新,MS在他们发布的命名空间中进行了大量的研究。

When you import assembly "their", typically the compiler will set it up into the global (reserved) namespace. In MSVC, you go to properties on the assembly reference, go to where it say's "Aliases", you can then specify a new name, other than global. Or actually a few names.

导入程序集“its”时,编译器通常会将其设置为全局(保留)命名空间。在MSVC中,您转到程序集引用的属性,转到它所说的“别名”的位置,然后您可以指定除全局之外的新名称。或者实际上是几个名字。

Let's say you use the imaginative name of "global2".

假设您使用富有想象力的名称“global2”。

You then goto your source files and at the TOP before any namespace declarations, you place;

然后,您可以在任何名称空间声明之前转到源文件并在TOP处放置;

extern alias global2;
using global2::System;

Your code can then use the types from global2, like "Int32" or whichever, you can still rename it via;

然后,您的代码可以使用global2中的类型,如“Int32”或其中任何一种,您仍然可以通过它重命名;

extern alias global2;
using global2::System;
using orig = System;

#9


0  

btw, CodeBehind isn't old and not used!

顺便说一句,CodeBehind不老,不用!

CodeBehind= is for pages in Web Application (with .Designer.cs files) and CodeFile= is for page in Web Site (dynamically compiled assemblies so without .Designer.cs files)

CodeBehind =用于Web应用程序中的页面(带有.Designer.cs文件),CodeFile =用于Web站点中的页面(动态编译的程序集,因此没有.Designer.cs文件)

#10


0  

I had this issue today with a Web USer Control but discovered that changing CodeBehind="..." to Src="..." is the cause of the error. [link]http://stevenoderayi.blogspot.com/2011/04/resolved-cs0433-type-user-control.html[/link]

我今天在Web USer Control中遇到过这个问题,但发现将CodeBehind =“...”更改为Src =“...”是导致错误的原因。 [链接] http://stevenoderayi.blogspot.com/2011/04/resolved-cs0433-type-user-control.html [/链接]