You are currently offline, waiting for your internet to reconnect

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

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 SubEnd Module 

However, the following code will compile successfully:
Imports System.Windows.FormsModule Module1  Sub Main()    MessageBox.Show("Example")  End SubEnd Module

The following code will also compile successfully:
Module Module1  Sub Main()    System.Windows.Forms.MessageBox.Show("Example")  End SubEnd Module

Properties

Article ID: 2971004 - Last Review: 05/29/2014 11:15:00 - Revision: 1.0

  • Microsoft .NET Framework 4.5.2
  • kbsurveynew kbexpertiseinter kbtshoot KB2971004
Feedback
document.write("