.NET MVC3 - 发布网站时 /Content 文件夹中的文件夹丢失
我的 /Content 文件夹中有一个文件夹,当我构建和发布我的网站时,该文件夹未包含在内。仅包含标准 CSS、图像、脚本和主题文件夹。我还有一个“下载”文件夹,其中包含尚未包含的 .doc 文件。
我是否仅限于/内容以下级别设置的标准?
I have a folder in my /Content folder which is not being included when I build and publish my website. Only the standard CSS, Images, Scripts and themes folders have been included. I also have a Downloads folder containing .doc files that has not been included.
Am I limited to the standard set at the level below /Content?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常不会部署空文件夹。
对于“下载”文件夹,其包含的项目的“构建操作”设置为多少?对于您想要部署的任何内容,它们应该设置为“内容”。对于某些文件类型(例如 PDF 等),不会自动设置此设置。
部署的唯一项目必须在项目中引用(也就是说,它们必须出现在解决方案资源管理器中,而不仅仅是出现在文件夹中)在磁盘上)
,并设置正确的构建操作。
您还可以将“复制到输出目录”设置设置为 True 并查看会发生什么情况。
Empty folders typically don't get deployed.
For the Downloads folder, what's the "Build Action" set to for the items that it contains? They should be set to "Content" for anything that you want deployed. This isn't automatically set for some file types, such as PDF, etc.
The only items that get deployed have to be both referenced in the project (that is, they have to appear in the solution explorer, not just present in the folder on disk)
, and have the correct build action set.
You might also set the "Copy To Output Directory" setting to True and see what happens.
在 Visual Studio 中,右键单击
/Content
文件夹下的每个文件夹,然后选择包含在项目中。否则,这些文件仅物理地存在于磁盘上,但项目不知道它们在那里并且不会发布它们。In Visual Studio, right click on every folder underneath
/Content
folder, and choose Include In Project. Else, the files are only physically there on disk but the project doesn't know they are there and doesn't publish them.