VB.Net namespace not recognized in invoke code activity

  1. In a library project ,create a new sequence called tmp.
  2. Add an invoke code activity.
  3. Add a single line of code to the invoke code activity:
    Dim openDlg As New OpenFileDialog
  4. In the Imports tab, add the System.Windows.Forms namespace.
  5. Run the file. An error occurs: error BC30002: Type ‘OpenFileDialog’ is not defined. At line 1

Here’s the maddening part:

  1. I have this same exact code in another sequence in the same library project and it works as expected.
  2. Even if I explicitly quality the namespace in the invoke code activity:
    Dim openDlg As New System.Windows.Forms.OpenFileDialog

the namespace is still not recognized and the same error occurs!

Is this a dumb question? I am seeing this for a number of vb.net calls, including DialogResult, even though according to the Microsoft language docs I’m including the correct namespace.