# Visual Studio .net - getting files in solution

**URL:** <https://boards.straightdope.com/t/visual-studio-net-getting-files-in-solution/357153>\
**Category:** Factual Questions\
**Created:** [May 17, 2006, 8:21pm UTC](https://boards.straightdope.com/t/visual-studio-net-getting-files-in-solution/357153 "2006-05-17T20:21:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxTheVool](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@MaxTheVool](https://boards.straightdope.com/u/MaxTheVool)\
**Post date:** [May 17, 2006, 8:21pm UTC](https://boards.straightdope.com/t/visual-studio-net-getting-files-in-solution/357153/1 "2006-05-17T20:21:10Z")

</div>

I’m trying to write a compile preprocessor of sorts for a Visual [Studio.net](http://Studio.net) solution. I need to get a list of every file in the solution, both source and header files.

Can anyone point me towards how to do this?

thanks

---

<div class="post-metadata">

**Author:** ![DarrenS](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@DarrenS](https://boards.straightdope.com/u/DarrenS)\
**Post date:** [May 17, 2006, 10:43pm UTC](https://boards.straightdope.com/t/visual-studio-net-getting-files-in-solution/357153/2 "2006-05-17T22:43:05Z")

</div>

Looks like you’ll have to drill down into Common Environment Object Model, then go from Solution -\> Projects -\> ProjectItems

Sample navigation code [here](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxlrfprojectsinterface.asp) .

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [May 17, 2006, 11:51pm UTC](https://boards.straightdope.com/t/visual-studio-net-getting-files-in-solution/357153/3 "2006-05-17T23:51:15Z")

</div>

It might be easier to replace cl.exe with a copy of your own that does the preprocessing for every file it’s called on and then invokes the default cl.exe with all the switches that were passed in.

---

<div class="post-metadata">

**Author:** ![MaxTheVool](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@MaxTheVool](https://boards.straightdope.com/u/MaxTheVool)\
**Post date:** [May 18, 2006, 12:49am UTC](https://boards.straightdope.com/t/visual-studio-net-getting-files-in-solution/357153/4 "2006-05-18T00:49:23Z")

</div>

Actually I just parsed through the .xml in the .vcproj file in a quick and dirty fashion. Wheeeeee.
