将空目录发布到VS2010 Web项目中的Web应用程序 [英] publish empty directories to a web application in VS2010 web project
问题描述
我经常需要发布一个保留目录树的Web项目,即使目录为空,例如,用于保存上载文件的目录。
如果我使用VS2010 publish命令发布应用程序,则不会在Web服务器的远程文件系统上创建空目录。
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.
有没有办法强制VS在目标目录上创建某些文件夹(尽管是空的)?
谢谢!
Is there a way to force VS to create certain folders, albeit empty, on the target directory? thanks!
推荐答案
不可能,这恐怕也有同样的问题。如果要预编译工具生成这些空文件夹,则需要在每个空目录中创建一个placeholder.txt文件。否则,您将无法创建将在构建后事件中创建文件夹的命令行应用程序(但仅在使用Web应用程序项目而非网站项目的情况下)。
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).
希望这会有所帮助。
这篇关于将空目录发布到VS2010 Web项目中的Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!