Tip: Add multiple files and folders to an AVR Studio project quickly

Imagine you have a a folder full of source code that you want to add to your AVR Studio project. The obvious way to do that is to add each file one by one by right clicking on the project and choosing Add -> Existing Item. Beyond a couple of files though, that gets annoying  to do- you cannot choose multiple files in the dialog that pops up.

There's an easier (and unfortunately not so obvious) way. Check out this screenshot of the Solution Explorer - in particular, note the second toolbar button. That toolbar button is only visible if the selected item in the Solution Explorer window is either the project itself (EVK1101-DEMO1 in the screenshot) or an item in the project.

That toolbar button is actually a toggle that switches between showing all files/folders in the project directory, versus just showing those that have been explicitly added to the project. In the above screenshot (with Show All Files turned on), the asf folder and asf.h file are showing up with different (ghosted?) icons to indicate that they are in the project directory but are not part of the project.

How do you make them part of the project? Just right click on the folder/file and say Include In Project. Can't be any easier, can it?

This only works for files and folders inside the project directory though. If you want to add code outside the project directory, you'll have to first copy them inside the project directory, turn on Show All Files and then include them into the project.

Adding a folder adds everything under the folder recursively. Adding a specific sub folder also works, just navigate to that sub folder inside Solution Explorer and choose to include it in the project.