将空目录发布到 VS2010 web 项目中的 web 应用程序 [英] publish empty directories to a web application in VS2010 web project

查看:20
本文介绍了将空目录发布到 VS2010 web 项目中的 web 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常需要发布一个保留目录树的 web 项目,即使目录是空的,例如,保存上传文件的目录.如果我使用 VS2010 发布命令发布我的应用程序,则不会在远程文件系统、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 文件.如果您无法创建一个命令行应用程序,它将在您的构建后事件中创建文件夹(但前提是您使用的是网络应用程序项目而不是网站项目).

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆