none
error BC30002: Type 'Microsoft.VisualBasic.CompilerServices.DesignerGenerated' is not defined. RRS feed

  • Question

  • I created a VB project in Visual Studio 2017. I designed all of my window forms but when I went to build the project I received the following error: BC30002: Type 'Microsoft.VisualBasic.CompilerServices.DesignerGenerated' is not defined. I search in my bin -> debug folder but it is empty. They said this error is found in my MainWindow.vb but this form generated on its own and I have no idea what to do about this error. Can you please assist me in this. I will attach the entire generated code below.

    #ExternalChecksum("..\..\MainWindow.xaml","{406ea660-64cf-4c82-b6f0-42d48172a799}","00CD9E93D04A79E59363DB876E6B6C05")
    '------------------------------------------------------------------------------
    ' <auto-generated>
    '     This code was generated by a tool.
    '     Runtime Version:4.0.30319.42000
    '
    '     Changes to this file may cause incorrect behavior and will be lost if
    '     the code is regenerated.
    ' </auto-generated>
    '------------------------------------------------------------------------------
    
    Option Strict Off
    Option Explicit On
    
    Imports Ralmar
    Imports System
    Imports System.Diagnostics
    Imports System.Windows
    Imports System.Windows.Automation
    Imports System.Windows.Controls
    Imports System.Windows.Controls.Primitives
    Imports System.Windows.Data
    Imports System.Windows.Documents
    Imports System.Windows.Ink
    Imports System.Windows.Input
    Imports System.Windows.Markup
    Imports System.Windows.Media
    Imports System.Windows.Media.Animation
    Imports System.Windows.Media.Effects
    Imports System.Windows.Media.Imaging
    Imports System.Windows.Media.Media3D
    Imports System.Windows.Media.TextFormatting
    Imports System.Windows.Navigation
    Imports System.Windows.Shapes
    Imports System.Windows.Shell
    
    
    '''<summary>
    '''MainWindow
    '''</summary>'
    
    ''ERROR FOUND HERE'
    <Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>  _
    Partial Public Class MainWindow
        Inherits System.Windows.Window
        Implements System.Windows.Markup.IComponentConnector
        
        
        #ExternalSource("..\..\MainWindow.xaml",14)
        <System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")>  _
        Friend WithEvents Panel1 As System.Windows.Controls.DockPanel
        
        #End ExternalSource
        
        Private _contentLoaded As Boolean
        
        '''<summary>
        '''InitializeComponent
        '''</summary>
        <System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")>  _
        Public Sub InitializeComponent() Implements System.Windows.Markup.IComponentConnector.InitializeComponent
            If _contentLoaded Then
                Return
            End If
            _contentLoaded = true
            Dim resourceLocater As System.Uri = New System.Uri("/Ralmar;component/mainwindow.xaml", System.UriKind.Relative)
            
            #ExternalSource("..\..\MainWindow.xaml",1)
            System.Windows.Application.LoadComponent(Me, resourceLocater)
            
            #End ExternalSource
        End Sub
        
        <System.Diagnostics.DebuggerNonUserCodeAttribute(),  _
         System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0"),  _
         System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never),  _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes"),  _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"),  _
         System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")>  _
        Sub System_Windows_Markup_IComponentConnector_Connect(ByVal connectionId As Integer, ByVal target As Object) Implements System.Windows.Markup.IComponentConnector.Connect
            If (connectionId = 1) Then
                Me.Panel1 = CType(target,System.Windows.Controls.DockPanel)
                Return
            End If
            Me._contentLoaded = true
        End Sub
    End Class
    
    

    Wednesday, March 29, 2017 3:12 PM

All replies

  • >> I designed all of my window forms but when I went to build the project

    What is your project type? Based on “MainWindow.vb”, it seems to be winform, but "..\..\MainWindow.xaml" is the component of WPF.

    Could you share us detail steps to reproduce your issue from scratch? I create a new winform project and WPF project, both work correctly.

    According your previous thread, it seems you create a winform project, if so, the Designer.vb should be like below:

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Class Form1
        Inherits System.Windows.Forms.Form
    
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub
    
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
    
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            components = New System.ComponentModel.Container()
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.Text = "Form1"
        End Sub
    
    End Class
    


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, March 30, 2017 5:29 AM
  • Hi Edward, sorry for reply to this old thread, but I have the same problem.

    I'm debugging an WPF application that has something like fifteen years old... But when I regenerate the project, I've got the BC30002 error in Page1.g.vb

    at line 41 : <Microsoft.VisualBasic.CompilerServices.DesignerGenerated>.

    Here is the code of this auto-generated file :

    #ExternalChecksum("..\..\Page1.xaml","{8829d00f-11b8-4213-878b-770e8597ac16}","CEDFE7CB5A5B5201E450649DEE7F02BD7ECAA085523595782B04A350588745E3")
    '------------------------------------------------------------------------------
    ' <auto-generated>
    '     Ce code a été généré par un outil.
    '     Version du runtime :4.0.30319.42000
    '
    '     Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
    '     le code est régénéré.
    ' </auto-generated>
    '------------------------------------------------------------------------------
    
    Option Strict Off
    Option Explicit On
    
    Imports Infragistics.Windows.DataPresenter
    Imports System
    Imports System.Diagnostics
    Imports System.Windows
    Imports System.Windows.Automation
    Imports System.Windows.Controls
    Imports System.Windows.Controls.Primitives
    Imports System.Windows.Data
    Imports System.Windows.Documents
    Imports System.Windows.Ink
    Imports System.Windows.Input
    Imports System.Windows.Markup
    Imports System.Windows.Media
    Imports System.Windows.Media.Animation
    Imports System.Windows.Media.Effects
    Imports System.Windows.Media.Imaging
    Imports System.Windows.Media.Media3D
    Imports System.Windows.Media.TextFormatting
    Imports System.Windows.Navigation
    Imports System.Windows.Shapes
    Imports System.Windows.Shell
    
    
    '''<summary>
    '''Page1
    '''</summary>
    <Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>  _
    Partial Public Class Page1
        Inherits System.Windows.Controls.Page
        Implements System.Windows.Markup.IComponentConnector

    I've tried to insert the "Global" namespace before Microsoft, it seems to work, but each time I generate the project, this namespace is automatically deleted...

    Thanks for your help !


    Monday, June 22, 2020 7:04 AM