How to publish empty folders with Visual Studio publish

When you use the Publish option in Visual Studio, it will not publish the empty folders. But sometimes we need the empty folders too to be published (In case if we wish to keep some data in those folders after we publish the site). If we are going to create those folders at the production environment manually, it would be a pain since we have to create those each time we publish the application and we have to take care about the spellings of the folder names if we have used them in the code. There is a little trick we can do to make empty folders get published.

1. Add an empty text file inside that folder.

2. Go to the properties of the text file and set the Build Action to Content.


Now it will publish the empty folder too.

No comments: