vb.net Sub New() 有多个具有相同签名的定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26956781/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Sub New() has multiple definitions with identical signatures
提问by Amir Ismail
I was working in ASP.Net web forms application (website not web application) on Win 7 and everything was fine.
我在 Win 7 上的 ASP.Net Web 表单应用程序(网站不是 Web 应用程序)中工作,一切都很好。
I had to transfer my solution to another machine also win 7, once I did that everything became NOT OK.
我不得不将我的解决方案转移到另一台机器也赢得 7,一旦我这样做,一切都变得不正常。
when I build my solution I got tons of building errors in files existing in
当我构建我的解决方案时,我在现有文件中遇到了大量构建错误
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
most of these errors such
大多数这些错误,例如
Protected Sub New(info As System.Runtime.Serialization.SerializationInfo, context As System.Runtime.Serialization.StreamingContext) has multiple definitions with identical signatures.
Protected Sub New(info As System.Runtime.Serialization.SerializationInfo, context As System.Runtime.Serialization.StreamingContext) has multiple definitions with identical signatures.
and
和
Public Sub New()' has multiple definitions with identical signatures.
Public Sub New()' has multiple definitions with identical signatures.
I googled it and tried all solution stated in all sites. clearing my solution and rebuild it,
clearing Temporary ASP.NET Filesfolder, clearing C:\Users\user\AppData\Local\Tempand also manually deleted .NETFramework,Version=v4.0.AssemblyAttributes.csexists in Temp folder
我用谷歌搜索并尝试了所有网站中规定的所有解决方案。清除我的解决方案并重建它,清除Temporary ASP.NET Files文件夹,清除C:\Users\user\AppData\Local\Temp并手动删除.NETFramework,Version=v4.0.AssemblyAttributes.cs存在于 Temp 文件夹中
even I created new solution with different name but of course I imported files from old solution.
即使我创建了不同名称的新解决方案,但当然我从旧解决方案导入了文件。
Nothing work for me, I don't know what is the problem exactly and why it happen and how can I solve it and back my solution to live?
没有什么对我有用,我不知道问题到底是什么,为什么会发生,我该如何解决并支持我的解决方案?
回答by Steve
Usually when you use Visual Studio to generate some code for you (for data or whatever) it does them as Partial Class ...so you can create another partial class and add your own code to the same class without loosing your changes when the tool regenerates it's code. Long story.
通常,当您使用 Visual Studio 为您生成一些代码(用于数据或其他)时,它会执行它们,Partial Class ...以便您可以创建另一个分部类并将您自己的代码添加到同一个类中,而不会在工具重新生成代码时丢失您的更改。很长的故事。
Anyway, since this is a web site, all files in the folder are part of the project. If you accidently copy the same file twice, it is automatically added and your partial class with the same methods and properties (like NEW) now have multiple definitions.
无论如何,由于这是一个网站,文件夹中的所有文件都是项目的一部分。如果您不小心将同一个文件复制了两次,它会自动添加,并且具有相同方法和属性(如 NEW)的分部类现在有多个定义。
Look for copies of the same classes.
寻找相同课程的副本。

