哪里错误CS0433"类型'X'已存在两个A.DLL和B.DLL"来自? [英] Where does error CS0433 "Type 'X' already exists in both A.dll and B.dll " come from?

查看:199
本文介绍了哪里错误CS0433"类型'X'已存在两个A.DLL和B.DLL"来自?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行使用内部Web服务器(IIS没有)我收到上面提到的错误从Visual Studio 2008 SP1 web应用程序。

When I run a webapp from Visual Studio 2008 SP1 using the internal web server (not IIS) I receive the above mentioned error.

完整的错误(源文件的 Default.aspx.cs 的):

The full error (source file Default.aspx.cs):

编译器错误信息:CS0433:本
  类型'WebApplication3.Site1存在
  都
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时
  ASP.NET
  文件\\ ROOT \\ aa563bcf \\ 59deedc0 \\ App_Web_site1.master.cdcab7d2.muczzy9v.dll
  和
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时
  ASP.NET
  文件\\ ROOT \\ aa563bcf \\ 59deedc0 \\装配\\ DL3 \\ 44c3a3cf \\ 80dd34ed_6968ca01 \\ WebApplication3.DLL

Compiler Error Message: CS0433: The type 'WebApplication3.Site1' exists in both 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\aa563bcf\59deedc0\App_Web_site1.master.cdcab7d2.muczzy9v.dll' and 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\aa563bcf\59deedc0\assembly\dl3\44c3a3cf\80dd34ed_6968ca01\WebApplication3.DLL'

在preceding已满警告:

The preceding full warning:

警告:CS0436:类型
  WebApplication3._Default在
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时
  ASP.NET
  文件\\ ROOT \\ aa563bcf \\ 59deedc0 \\ App_Web_default.aspx.cdcab7d2._tlkwdos.0.cs
  与进口类型冲突
  WebApplication3._Default在
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时
  ASP.NET
  文件\\ ROOT \\ aa563bcf \\ 59deedc0 \\装配\\ DL3 \\ 44c3a3cf \\ e096e61c_6568ca01 \\ WebApplication3.DLL。
  使用中所定义的类型
  C:\\ WINDOWS \\ Microsoft.NET \\框架\\ V2.0.50727 \\临时
  ASP.NET
  文件\\ ROOT \\ aa563bcf \\ 59deedc0 \\ App_Web_default.aspx.cdcab7d2._tlkwdos.0.cs。

Warning: CS0436: The type 'WebApplication3._Default' in 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\aa563bcf\59deedc0\App_Web_default.aspx.cdcab7d2._tlkwdos.0.cs' conflicts with the imported type 'WebApplication3._Default' in 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\aa563bcf\59deedc0\assembly\dl3\44c3a3cf\e096e61c_6568ca01\WebApplication3.DLL'. Using the type defined in 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\aa563bcf\59deedc0\App_Web_default.aspx.cdcab7d2._tlkwdos.0.cs'.

警告点源到中间文件的 App_Web_default.aspx.cdcab7d2._tlkwdos.0.cs 的:

Source of warning points to an intermediate file App_Web_default.aspx.cdcab7d2._tlkwdos.0.cs:

Line 162:    
Line 163:    [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()]
Line 164:    public class default_aspx : global::WebApplication3._Default, System.Web.IHttpHandler {
Line 165:        
Line 166:        private static bool @__initialized;

和我的问题:在哪里?这是否来自

and my question: where does this come from?

web应用程序(而不是网站!)有一个的 Default.aspx的的和一个的 Site1.Master 的,没有依赖关系。他们几乎是空的,用 ASP:标签在页面上。 previously,这个Web应用程序正常工作。当我删除到主在Default.aspx.cs任何引用,一切顺利。主只有一些code。

The webapp (not website!) has one Default.aspx and one Site1.Master, no dependencies. They're almost empty, with an asp:Label on the page. Previously, this webapp worked fine. When I remove any references in Default.aspx.cs to the master, all goes well. The master has some code only.

它实际上是一个许多小发射后不管的webapps测试,所以我一点也不在乎。但是,我从来没有见过这个,现在我很好奇什么就做什么,其他然后复制code到一个新的项目(清洗液并不能帮助)。

It's actually one of many little fire-and-forget test webapps, so I couldn't care less. But I hadn't seen this before and now I'm curious of what to do, other then copying code into a new project (cleaning solution doesn't help).

请注意:我读过<一个href=\"http://stackoverflow.com/questions/371426/asp-net-error-the-type-foo-exists-in-both-temp1-dll-and-temp2-dll\">this帖子和其他一些人,他们不适用。

Note: I've read this post and some others, they don't apply.

推荐答案

在这个问题的的应用程序引起的错误(例如,重复的类名):

When this issue is not caused by a bug in the application (e.g., duplicate class name):

此问题似乎在更改应用程序的项目,结果在一个新的版本(例如,code /参考/资源变化)后作出present。这个问题似乎在于这个新构建的输出中:因各种原因Visual Studio是不更换的全部的应用程序的OBJ文件/文件夹斌的内容。这将导致至少在一些的应用程序的bin文件夹是过时的内容。

This issue appears to present after a change is made to the application's project that results in a new build (e.g., code/reference/resource change). The issue appears to lie within the output of this new build: for various reasons Visual Studio is not replacing the entire contents of your application's obj/bin folders. This results in at least some of the contents of your application's bin folder being out of date.

当发生所述问题,清理出临时ASP.NET文件文件夹,独自一人,没有解决不了的问题。它解决不了的问题,因为你的应用程序的bin文件夹的陈旧内容被复制回临时ASP.NET文件应用程序进行访问,下一次文件夹,导致此问题继续存在。关键是要消除所有现有文件和强制的Visual Studio来重建每一个对象,所以,下一次你的应用程序访问新宾文件将被复制到临时ASP.NET文件文件夹中。

When said issue occurs, clearing out the "Temporary ASP.NET Files" folder, alone, does not solve the problem. It cannot solve the problem, because the stale contents of your application's bin folder are copied back into the "Temporary ASP.NET Files" folder the next time your application is accessed, causing the issue to persist. The key is to remove all existing files and force Visual Studio to rebuild every object, so the next time your application is accessed the new bin files will be copied into the "Temporary ASP.NET Files" folder.

解决方案


  1. 关闭Visual Studio中

  2. 执行IISRESET

  3. 删除所有的临时ASP.NET文件文件夹中的文件夹和文件(路径是错误消息中引用)

  4. 删除有问题的应用程序的目标文件和bin的文件夹

  5. 重新启动Visual Studio并打开该解决方案

  6. 执行清理解决方案,接着是重新生成解决方案

说明


  • 第1-2步:从文件夹/文件,我们需要删除删除资源锁

  • 步骤3-4:删除所有旧版本的文件

  • 第5-6步:创建构建文件的新版本

这篇关于哪里错误CS0433&QUOT;类型'X'已存在两个A.DLL和B.DLL&QUOT;来自?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆