Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Namespace qualification issue when you recompile a VB.NET application to target the .NET Framework 4.5.2


Symptoms

You may receive the following error message during the compilation process when you recompile a VB.NET application to target the Microsoft .NET Framework 4.5.2:
'{Name}' is not a member of 'Windows'.

In this message, the "{Name}" placeholder is a child of the System.Windows namespace, such as "Forms" or "Markup."

For example,the error message may appear as follows:
'Forms' is not a member of 'Windows'.

↑ Back to the top


Resolution

This issue involves conflicts of the .NET Framework 4.5.2 "Windows" namespace. It will occur in code that uses Windows.{Name} to refer to System.Windows.{Name}.

To resolve the issue, change the code to fully qualify the namespace, or import the full namespace and reference its types by their simple name.

For example, the following code will cause the error:
Module Module1

Sub Main()

Windows.Forms.MessageBox.Show("Example")

End Sub

End Module

However, the following code will compile successfully:
Imports System.Windows.Forms


Module Module1

Sub Main()

MessageBox.Show("Example")

End Sub

End Module

The following code will also compile successfully:
Module Module1

Sub Main()

System.Windows.Forms.MessageBox.Show("Example")

End Sub

End Module

↑ Back to the top


Keywords: kbsurveynew, kbexpertiseinter, kbtshoot, kb

↑ Back to the top

Article Info
Article ID : 2971004
Revision : 1
Created on : 1/7/2017
Published on : 5/29/2014
Exists online : False
Views : 129