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:

Note

'{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:

Note

'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