How to create and build an application - nRF Connect for VS Code
Skip to content

How to create and build an application

Complete the steps listed on this page to create and build an nRF Connect SDK application or sample in Visual Studio Code. Make sure you have configured the application or sample according to your needs, as described on its documentation page.

How to create an application

Complete the following steps:

  1. Open the nRF Connect for VS Code extension by clicking its icon.
  2. From the Welcome View, click Create a new application.
    A quick pick menu appears.
  3. Choose one of the following options:

    • Create a blank application - This will create an application with a code structure that you need to populate from scratch.
    • Browse a sample - This will create an application from an nRF Connect SDK sample or an nRF Connect SDK application.
    • Browse application index - This will create an application from an out-of-tree nRF Connect SDK reference application that follows its own versioning scheme and uses custom west workspace settings. The available reference applications are listed in the online application index.
  4. Enter the location for the application. You can also use the folder button at the top of the quick pick to open a folder picker. A folder with the same name cannot already exist in the chosen location.
    The application creation process starts after you enter the name. When the application is created, a prompt appears.

  5. Click Open.
    This opens the new application in your current VS Code window and automatically adds it to the Applications View.


You can use the nrf-connect.defaultOpenAction setting to configure the default action to use when {{ VCS }} prompts you about opening an application.

How to build an application

Complete the following steps:

  1. Verify the configuration of the sample or application you are planning to build based on the information in the Configuration section in the application or sample documentation in the nRF Connect SDK. This section might contain information about application-specific Kconfig fragments or CMake build fragments.
  2. In the Applications View, click on Create new build configuration.

    Create new build configuration

    This opens the Add Build Configuration page.

    Add Build Configuration page

  3. Select the board onto which you want to program the sample.
    The supported boards are also listed in the application or sample documentation in the nRF Connect SDK, in the Requirements section.

  4. Add any desired snippets, Kconfig fragments, devicetree overlays, and extra CMake arguments.
  5. In Optimization level, select Use project default.
    This lets you build the application with the basic configuration.
    You can change this option later.
  6. Make sure the Build after generating configuration checkbox is selected.
  7. Click the Build Configuration button.
    This generates the configuration file and triggers the build process, which can take some time. You can monitor its progress in the notification that appears.

When the process is complete, the Actions View appears. In this View, you can trigger the build process again, flash the built sample, start a debug session, or generate a memory report. The build files appear in the build's Details View, which is named after your application.

Build configuration files

Testing and debugging the application

To test or debug the application or sample you have just built, see the How to flash, test, and debug page.

How to edit a build configuration

You can make changes to the configurations for any application you have already built.

  1. In the Applications View, click on the build folder that contains the files you want to edit.
  2. Click on the menu icon that is to the right, or right-click on the build folder.
  3. Click on Edit Build Configuration.
  4. After you have edited the configuration, click on Build Configuration to save your changes and rebuild the application with the new configuration.