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

爷,独闯天下 提交于 2019-11-28 01:49:35

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"
Maslow

You can do this programatically in your .proj file depending on your needs just like this answer

You just have to make sure you use the correct tag for the files.

Compile, Content, None, etc..

<ItemGroup>
  <Content Include="Images\**\*.*" />
  <Compile Include="Subdirectory\**\*.cs" />
</ItemGroup>

I don't think there is a way to do this natively in Visual Studio. Adding the files to the project modifies the project file.

This sounds like a good case for a simple addin. You can use the Visual Studio automation services to find the files you want added and add them all at once. You'd have complete control over the behavior of the addin, so you could reduce the process to a single click if practical.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!