How to: Verify Platform Support for Code in Device Projects

Visual Studio always validates that your code is supported by the target platform and generates warnings if it is not.

You can stop unsupported code from deploying by stipulating that all warnings should be treated as errors, so that the build fails.

For example, the following Visual Basic code, even though it compiles, would generate a warning or error in a Smartphone application because Smartphone does not support buttons.

Dim btn as System.Windows.Forms.Button

btn = new System.Windows.Forms.Button()

btn.Caption = "MyButton"

To treat all warnings as errors in Visual Basic

  1. In Solution Explorer, right-click <Projectname>, and then on the shortcut menu, click Properties.

  2. On the Compile tab, select Treat all warnings as errors.

To treat all warnings as errors in Visual C#

  1. In Solution Explorer, right-click <Projectname>, and then on the shortcut menu, click Properties.

  2. On the Build tab, select All in the Treat warnings as errors section.

See Also

Concepts

Creating and Developing Managed Device Projects