An implementation of Visual Basic that is built into Microsoft products.
BC30002 means a referenced type is not defined or not being resolved.
For a Form1.Designer.vb error in a WinUI/Windows app project, check these in order:
- Find the missing type name
BC30002 is raised when the code references a type that Visual Basic cannot find. In
Form1.Designer.vb, inspect the line reported around line 23 and identify the exact type name that is underlined or named in the Error List. - Verify spelling matches the declaration Make sure the type definition and the reference use the exact same spelling.
- Check accessibility of the type
If the type is declared in another module, class, or file, ensure it is accessible. If it was declared
Private, move it to the referencing module or declare itPublic. - Check namespace conflicts
If the project redefines a namespace that matches a framework namespace, fully qualify the type with
Global. The documented example isGlobal.System.ObjectwhenSystemis redefined in the project. - Check project references If the missing type comes from another assembly or library, add the required reference. Visual Basic can also raise related reference errors when an assembly containing a required interface or type is not directly referenced.
- If this is a test project referencing a WinUI project
Make sure the test project
TargetFrameworkmatches the WinUI project target framework. For example, if the WinUI project targets .NET 8 Windows, the test project should use:
Also update<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>RuntimeIdentifiersas required for WinUI test projects. - Clean and rebuild After fixing the missing type or reference, clean and rebuild the solution.
If the error is specifically in designer-generated code, the practical fix is usually one of these:
- a control or type used by the designer no longer exists,
- a required assembly reference is missing,
- the type is declared with the wrong access level,
- the project has a namespace/type naming conflict.
References: