0

Currently I'm using:

EntDTE.ProjectItems.AddFromDirectory()

to include the existing folder into VS project model, but this method includes into project all the contents of this folder too. Can folder can be simply added into project without adding all the subitems?

controlflow
  • 6,667
  • 1
  • 31
  • 55

3 Answers3

0

Why not use EnvDTE.ProjectItems.AddFolder() ? I think it'll just add a folder whether or not it exists and won't touch the content within the folder.

AASoft
  • 1,346
  • 8
  • 13
0

Actually it's not possible at all with current EnvDTE APIs.

controlflow
  • 6,667
  • 1
  • 31
  • 55
-1

This code will include directory without content

dirPI = EntDTE.ProjectItems.AddFromDirectory(dirPath);
dirPI.ProjectItems.OfType<EnvDTE.ProjectItem>().ToList().ForEach(item =>
{
    item.Remove();
});
Pranas
  • 1