The sample applications are designed to be built with Visual Studio on Windows, and with Visual Studio Code or the command-line interface (CLI) on both Windows and Linux, unless otherwise noted.
- Build and run a high-level sample with Visual Studio
- Build and run a high-level sample with Visual Studio Code
- Build and run a high-level sample with the CLI
To build and run real-time capable apps (RTApps), see Tutorial: Build a real-time capable application in the online documentation.
-
Install Visual Studio and the Azure Sphere Extension for Visual Studio, and any additional tools as described in the online documentation.
-
Open Visual Studio and select Open a local folder. Navigate to the folder that contains the sample you want to build. If the folder contains samples for both high-level apps and real-time capable apps (RTApps), make sure you open the correct folder.
-
If the application targets hardware-specific features, open the CMakeLists.txt file and change the TARGET_DIRECTORY setting to specify the folder that contains definitions for the hardware you're using. By default, the TARGET_DIRECTORY specifies HardwareDefinitions/mt3620_rbd, which matches the Seeed Azure Sphere MT3620 Development Kit:
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "../../../HardwareDefinitions/mt3620_rdb" TARGET_DEFINITION "sample_appliance.json")
Several hardware definitions are provided with the Azure Sphere SDK. For example, if you're using a SEEED MT3620 Mini Dev Board, specify HardwareDefinitions/seeed_mt3620_mdb instead.
-
In Visual Studio, select View > Output to display the Output window.
-
Ensure that your device is connected to your PC by USB.
-
In the Set startup item, select (HLCore) to build a high-level app.
-
Press F5 to build and deploy the application.
-
Install Visual Studio Code, the Azure Sphere Extension for Visual Studio Code, and any additional tools as described in the online documentation:
-
Start Visual Studio Code. Select File > Open Folder, and then select the folder that contains the sample you want to build. If the folder contains samples for both high-level apps and real-time capable apps (RTApps), make sure you open the correct folder.
-
If the application targets hardware-specific features, open the CMakeLists.txt file and change the TARGET_DIRECTORY setting to specify the folder that contains definitions for the hardware you're using. By default, the TARGET_DIRECTORY specifies HardwareDefinitions/mt3620_rbd, which matches the Seeed Azure Sphere MT3620 Development Kit:
azsphere_target_hardware_definition(${PROJECT_NAME} TARGET_DIRECTORY "../../../HardwareDefinitions/mt3620_rdb" TARGET_DEFINITION "sample_appliance.json")
Several hardware definitions are provided with the Azure Sphere SDK. For example, if you're using a SEEED MT3620 Mini Dev Board, specify HardwareDefinitions/seeed_mt3620_mdb instead.
-
Press F5 to build and debug the project. If the project has not previously been built, or if files have changed and rebuilding is required, Visual Studio Code will build the project before debugging starts.
-
Wait several seconds for Visual Studio Code to build the application, create an image package, deploy it to the board, and start it in debug mode. You'll see status updates in the Output pane along the way.