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

Article ID: 2971004 - View products that this article applies to.
Expand all | Collapse all

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'.

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

Properties

Article ID: 2971004 - Last Review: May 29, 2014 - Revision: 1.0
Applies to
  • Microsoft .NET Framework 4.5.2
Keywords: 
kbsurveynew kbexpertiseinter kbtshoot KB2971004

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com