4

I am maintaining a Setup project under VS2008. The project contains thousands of files arranged in a hierachy of folders.

Every now and then, I want to renew part of this hierarchy, which means deleting a number of nodes and reinserting the new content. I need to do that because some of the files are obsolete and need to be removed. It is much safer to delete all than to chase the obsolete files away.

Unfortunately, this is a very tedious task because you can't delete empty folders and you have to delete every node in the hierarchy one by one. In addition, for a large project, every deletion takes seconds.

Do you know of a way to speed-up or automate that task ? Merely erasing lines in the .vdproj file doesn't seem to work.

1 Answers1

0

If you do not feel too queasy about it.... This is worth the effort if changes are frequent.

The .vcproj file is in xml format. You could use explorer to manage your files, and write a small utility that checks and removes the (then) missing files from your project. The files are marked with tags, as in

<File
    RelativePath=".\AudioPlayerPane.cpp"
    >
</File>

You have to remove the entire "File" tag, that's 3 lines, or more, if the file has special compilation options, etc.. up to and including the "/File" tag. In addition, you will want to delete the .suo, .ncb and .cache files

It's too bad that boost.property_tree xml does not support any encoding other than UTF-8, as I would suggest you use that to recursively walk the vcproj file. This would make the utility very easy to write, and ensure the resulting file is correct. Maybe you can use the encoding capabilities of notepad++ to manually change the encoding of the file before and after changes.

Michaël Roy
  • 6,338
  • 1
  • 15
  • 19