thomas
thomas

Reputation: 1453

Publish empty sub folder in MVC5

I have a ASP.Net MVC 5 application. In this application I have an "Images" folder. As a sub folder, I have a "logos" folder which will be filled out by the application when requested.

When I publish (on file system), the sub folder is NOT published.

How can I publish this empty folder (without having to add a "dummy" image)?

Thanks.

Upvotes: 0

Views: 791

Answers (2)

Rafael Herscovici
Rafael Herscovici

Reputation: 17134

I do not understand the need to publish an Empty folder, Why not just try and create the folder on startup (or when needed)?

System.IO.Directory.CreateDirectory(Server.MapPath("~/images"));

It is not even needed to check if it pre-exists as the docs suggest

Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. The path parameter specifies a directory path, not a file path. If the directory already exists, this method does nothing.

Upvotes: 0

Andy Brown
Andy Brown

Reputation: 19171

Last I knew there was no way around this, and the VS team were aware. I get around it by putting an "empty" web.config in the folder.

Upvotes: 2

Related Questions