Build atmelstudio projects from command line

  1. Open cmd.exe
  2. Add Atmel Studio executable path to environment path variable.

set path=%PATH%;c:\program files\atmel\atmelstudio.exe

  1. Run the following command from the project folder
    c:\EXAMPLE1> atmelstudio.exe EXAMPLE1.cproj /build debug /out foo.txt

The above command will build the project in debug mode and you are free to mention any available configuration. Similar to /build you could also use /rebuild, /clean. To find a list of commands supported refer to this link. Am not sure if the %errorlevel% variable is updated properly to reflect the results of the build. But its better to find it from the build output file thus created, using some greping. The command will return immediately after invocation, but the build will run in the background. To wait for the build to complete. Try this START /WAIT atmelstudio.exe EXAMPLE1.cproj /build debug /out foo.txt

The build output will be stored in foo.txt in the project folder.

Hope this helps.

Advertisements