publish empty directories to a web application in VS2010 web project

pomarc picture pomarc · Nov 23, 2010 · Viewed 13.8k times · Source

Often I need to publish a web project preserving a directory tree even if the directories are empty, for example, directories to hold uploaded files. If I publish my app using the VS2010 publish command, the empty directories are not created on the remote filesystem, on the web server.

Is there a way to force VS to create certain folders, albeit empty, on the target directory? thanks!

Answer

Exitos picture Exitos · Nov 24, 2010

No this is not possible I'm afraid we had the same problem. You need to create a placeholder.txt file in each empty directory if you want the precompilation tool to generate these empty folders. Failing that you can create a command line app that will create the folders in your post build events (but only if you are using web application project not web site project).

Hope this helps.