I have a normal VS 2015 Setup project (installed the extension, so it looks like the Setup projects of VS 2010 and older).
In the 'File System on Target Machine' section, I've added a folder "MyAppFolder" and then added the primary output of one of the projects of the solution. VS then added a bunch of dll's as well.
However, when I try to delete the folder it says:
Cannot delete folder. Folder is not empty or it might contain excluded files, which are not shown.
Well yes, it is not empty. If I right-click on a single dll file, the "Delete" option is disabled.
I don't want this folder to be installed on the target machine. How do I get rid of this folder in my setup project?
The supported way to delete files from an installation that are no longer needed (for example, because they were used in a custom action) is to set the component id to null.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa368007(v=vs.85).aspx
See remarks about Component Id.
There is no support for this in Visual Studio setups, so it's typically done manually by editing the MSI file with a tool such as Orca.
In general I think you always need to delete the individual files before deleting the folder.