Search code examples
visual-studiovisual-studio-2008code-generation

How can I automatically add existing items to a Visual Studio project?


I have a tool which dynamically generates .xaml and .xaml.cs files and puts them in the appropriate Visual Studio directory.

To add them to the project, I have to then:

  • right-click on that directory
  • choose "add existing item"
  • navigate to the matching directory on the hard drive
  • select the two files that were created
  • click ok

Is there a way for me to tell the project to "include all existing items under the project folder on the hard drive"?


Solution

  • I do not have any automation for this. Still I follow following for the same requirement. This will avoid few clicking.

    • In solution Explorer highlight/Select "Show all files" button
    • Press control key (to multi select) and select files with mouse click to be included in solution.
    • Right click on any one of highlighted file, and select "Include in project"