'System.Runtime.InteropServices.DllImportAttribute' cannot be applied to a 'Declare'

The DllImportAttribute attribute was applied to a Declare function. This attribute can only be used with an empty Function or Sub.

Error ID: BC31523

To correct this error

  • Remove the DllImportAttribute attribute from the Declare statement.

See Also

Reference

DllImportAttribute

Declare Statement