views:

133

answers:

3

Hello,

I've downloaded source of an opensource C++ project. It is a Linux project. As Visual Studio is my favorite IDE I want to use it to browse & study the code. I created an empty C++ project and now want to add the source code to Solution explorer.

How can I add the directory structure to "Solution Explorer". Dropping the root folder of source code on the project in solution explorer is not working. Its just adding the files to the project but directory structure is lost.

Is there any way to preserve the directory structure? I do not want to recreate the directory structure manually.

+1  A: 

I am afraid there is no such concept in MSVS like "directory structure". Moreover, MSVS doesn't really need it because it uses flat projects and hierarchies are based on project level, not on the file/directory level.

As there is no such thing - you can't have it neither automatically nor manually. MSVS has solution folders which is quite different thing and there isn't much sense in expressing real folders as solution folders.

If you only want to look at the code in MSVS without having ability to build it - I'd suggest you to just add all the files from all folders into corresponding default solution folders (header files, source files) of your project; you'll also need to gather all the referenced linux headers and expose them to MSVS (as VC++ Include Dirs). After that you'll be able to use MSVS intellisence and class browser. Oh, and Visual Assist is even better :)

Andrey
+1  A: 

As you didn't seem to be getting any useful answers, I thought I'd post this. I don't use VS, but two possible alternative browsing tools (both free, open source) that do respect directory structures are:

  • Doxygen, which will give you a browser-based hyper-linked view of your source code.

  • Code::Blocks a C++ IDE (to add directories and subdirectories, use the "recursive add" feature.

anon
+1 for `Code::Blocks`. Its nice. It preserves the directory structure :)
claws
A: 

If you add your project file the the project root, then switch to "Show all Files" in the Solution Explorer panel (with a file in the project selected) Visual Studio will stop lying to you, and show the real directory structure, where you can use right-click "Include in project" to add source files to the project, and thus the browse/intellisense database.

Simon Buchan