Adding an existing source folder to AtmelStudio 6.2

All design tool related questions: compiler, assembler, linker. Embedded programming questions: assembler, C code.

Moderator: nferre

Andy Peters
Posts: 46
Joined: Mon Jul 08, 2013 11:09 pm

Adding an existing source folder to AtmelStudio 6.2

Mon Sep 01, 2014 7:02 am

I have a code module I want to test, and so I put the sources into a directory under the project's main directory:

projroot\debug
projroot\proj.atsln
projroot\prot.cproj
projroot\src
projroot\src\dut\source1.c
projroot\src\dut\source2.c
projroot\src\dut\source1.h

Where dut is the directory and you can see the sources under it. The directory dut and the sources in it do not automatically appear in the Solution, so I right-click on the src folder in the Solution Explorer and choose "add" then "existing item."

I mouse to the dut directory, and click "add" but that doesn't add the directory. Instead, it just opens it, revealing the sources in it. Now if I select all of the sources and click "add," all of the files are copied to the src directory.

That's not what I want. I want Visual Studio to NOT copy the files, just leave them in place and add the directory and its contents to the project.

What am I missing? 
jharley
Posts: 238
Joined: Thu Dec 06, 2012 6:40 am

Re: Adding an existing source folder to AtmelStudio 6.2

Mon Sep 01, 2014 11:17 pm

This should do what you want ;)

Three easy steps (albeit not very easy to find, you can blame visual studio)...

After you copy the directory structure to the project directory. Then in Atmel Studio - Solution Explorer...
1) Make sure your project is selected as the "Startup Project" (if you only have one project in the solution, it will already be selected)
2014-09-01 16_58_07-samd20 - AtmelStudio.jpg
2014-09-01 16_58_07-samd20 - AtmelStudio.jpg (9.99 KiB) Viewed 2380 times
2) Click on "Show All Files". Your source code directory you copied into the project directory should show up here as a "dashed folder". (For this example i copied a folder named "Build" into the AS project directory.)
NOTE: if you copied your folder lower in the tree you will have to expand the tree until you locate it.
2014-09-01 17_01_02-Welcome to AT91SAM Community Discussions • Post a reply.jpg
2014-09-01 17_01_02-Welcome to AT91SAM Community Discussions • Post a reply.jpg (11.65 KiB) Viewed 2380 times
3) Right click on the folder and select "Include In Project"
(You are not limited to just including the base folder, for example if you only wanted to include a sub folder, just expand tree and select "Include In Project" on the sub folder)
2014-09-01 17_06_14-samd20 - AtmelStudio.jpg
2014-09-01 17_06_14-samd20 - AtmelStudio.jpg (22.5 KiB) Viewed 2380 times
Done!

To remove an added folder: right click and select "Remove" then you have a choice to make "Remove" - from project (keeping the files) or "Delete".

Best Regards
jharley
Posts: 238
Joined: Thu Dec 06, 2012 6:40 am

Re: Adding an existing source folder to AtmelStudio 6.2

Tue Sep 02, 2014 12:46 am

Yes. It will include everything from the folder you selected all the way down the tree.
Andy Peters
Posts: 46
Joined: Mon Jul 08, 2013 11:09 pm

Re: Adding an existing source folder to AtmelStudio 6.2

Tue Sep 02, 2014 5:02 am

jharley wrote:This should do what you want ;)
And hey, that worked. It would be nice if Visual Studio's online help had something about that!

-a
jharley
Posts: 238
Joined: Thu Dec 06, 2012 6:40 am

Re: Adding an existing source folder to AtmelStudio 6.2

Tue Sep 02, 2014 5:36 am

Andy Peters wrote:It would be nice if Visual Studio's online help had something about that!
They do have some obscure help on this...
http://msdn.microsoft.com/en-us/library ... 00%29.aspx

I just wish you could apply a set of wildcards to control what is "Included".

I would make an add-on for this but I only do this a couple of times a year, so i just sanitize the directory before i "Include" it.
jharley
Posts: 238
Joined: Thu Dec 06, 2012 6:40 am

Re: Adding an existing source folder to AtmelStudio 6.2

Tue Sep 02, 2014 1:03 pm

I did say the information was obscure ... :lol:
And there is no mention to how this works with folders.
2014-09-02 06_58_31-How to_ Remove, Delete, and Exclude Items.jpg
2014-09-02 06_58_31-How to_ Remove, Delete, and Exclude Items.jpg (26.67 KiB) Viewed 2317 times

Return to “Development Tools”

Who is online

Users browsing this forum: No registered users and 1 guest