VB.Net具有相同签名的多个定义

时间:2017-08-17 04:53:43

标签: vb.net

1>------ Build started: Project: Major 2, Configuration: Debug Any CPU ------
1>  COM Reference 'WMPLib' is the interop assembly for ActiveX control 'AxWMPLib' but was marked to be linked by the compiler with the /link flag. This COM reference will be treated as a reference and will not be linked.
1>C:\Users\James\Google Drive\School\SDD\VB Work\VB Task 2\Major 2\Major 2\My Project\Application1.Designer.vb(25,20): error BC30269: 'Public Sub New()' has multiple definitions with identical signatures.
1>C:\Users\James\Google Drive\School\SDD\VB Work\VB Task 2\Major 2\Major 2\My Project\Application1.Designer.vb(34,33): error BC30269: 'Protected Overrides Sub OnCreateMainForm()' has multiple definitions with identical signatures.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我做错了什么?

Namespace My

    'NOTE: This file is auto-generated; do not modify it directly.  To make changes,
    ' or if you encounter build errors in this file, go to the Project Designer
    ' (go to Project Properties or double-click the My Project node in
    ' Solution Explorer), and make changes on the Application tab.
    '
    Partial Friend Class MyApplication

        <Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
        Public Sub New()
            MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
            Me.IsSingleInstance = false
            Me.EnableVisualStyles = true
            Me.SaveMySettingsOnExit = true
            Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterAllFormsClose
        End Sub

        <Global.System.Diagnostics.DebuggerStepThroughAttribute()>  _
        Protected Overrides Sub OnCreateMainForm()
            Me.MainForm = Global.Major_2.Main_Screen
        End Sub
    End Class
End Namespace

这是代码中的双倍增加,但我不知道应用程序设计器中有什么变化。

2 个答案:

答案 0 :(得分:0)

因此,谷歌驱动器复制了我的一个文件,所以有两个,它打开了两个

答案 1 :(得分:0)

错误原因:

似乎VS有时会复制Application.Designer.vb部分下的Application.myapp文件,(或者它可能是由作者所做的人为错误引起的),对于正确工作的项目,它应该只是有 ONE Application.Designer.vb档案。

<强>解决方案:

要修复此错误,您需要删除额外的Application.Designer.vb文件。结果应该如下图所示。

enter image description here