Tip #105: Did you know … How to include empty directory when package a web application?


By design, Visual Studio 2010 will skip the empty directory when packaging web application project using web deploy.  To get empty directory packaged and deployed, we can work around this by adding an empty stub file inside the directory to make it non-empty. Then web deploy will package and deploy the directory with the stub file.

– Xinyang Qiu |Visual Web Developer Team

Comments (6)

  1. Sandun says:

    As I know this is not a VS 2010 specific problem. This was there for previous versions as well. This post explains how the developers work with this matter. But I think there should be an option from Visual Studio it self to add (or give a message about empty directories.) empty directories on users request. 🙂

  2. Xinyang says:

    Thanks for the feedback.  I’ve logged your suggestion in our database for us to consider it in future releases.

  3. DK says:

    Skipping empty directories when it has been added to a project and having to add *stub files* is idiotic!

  4. BW says:

    "Skipping empty directories when it has been added to a project and having to add *stub files* is idiotic!"

    +1

    It's as if the people that write Visual Studio spend so much time writing it and not using it they miss out on all the little parts that need polished.

  5. Gabriel Lozano-Moran says:

    +1 to see this fixed in the next release. This has been more than a year ago and it could have been easily fixed imho in SP1.

  6. R. Tanenbaum says:

    Visual Studio 2010 will not publish empty folders.

    There was a bug report to Microsoft about this and they said that they would not fix it.

    connect.microsoft.com/…/publish-deploy-does-not-deploy-empty-folders

    Too bad. Because it used to work in Visual Studio 2008.

    Add a dummy file like dummy.txt to the directory and then the directory will be created.

    Note that it is not necessary to actually deploy the dummy file. It only needs to exist as part of the project in the build environment.