文件夹未使用 VS Publish / Web Deploy 上传
我正在使用 VS 2010 中的“发布/Web 部署”选项来发布我的 ASP.NET MVC3 网站。
但是,默认情况下它不会发布我在下面突出显示的“文件”文件夹。
有什么想法可以在发布过程中包含此文件吗?
谢谢保罗
I am using the Publish / Web Deploy option within VS 2010 to publish my ASP.NET MVC3 website.
However it does not by default publish my "files" folder that I have highlighted below.
Any ideas how I can get this file included during publishing?
Thanks Paul
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 Visual Studio 解决方案资源管理器中,您需要右键单击该目录中每个文件并选择属性(您可以一次选择所有文件,然后右键单击 -> 属性,如果您想更改所有文件)。
确保构建操作设置为内容。这将确保在发布过程中复制文件。
Within the Visual Studio Solution Explorer you need to right-click and select properties on each of the files within that directory (you can select them all at once and then right-click -> properties if you want to change them all).
Make sure the Build Action is set to Content. This will ensure that the files are copied as part of the publish process.
就我而言,
Error.txt 文件未包含在项目中
,并且在发布项目期间未添加文件夹。我
右键单击文件名,然后单击
“包含在项目中”In my case, the
Error.txt file was not included in the Project
and the Folder was not added during the Publish project.I
right-click the file name and click on
"Include in Project"一种可能不太常见的情况是,某人(可能是您自己)在 csproj 文件中添加了
Content\files
行,然后忘记了它,后来您确实想要发布文件夹。由于这一行,即使 BuildAction 是
Content
,Content/files(和子文件夹)中的任何文件都不会被部署。这很难发现,因为据我所知,它在 Visual Studio 中的任何地方都不可见,您必须使用文本编辑器打开 csproj 文件。
A probably less common case is when someone (maybe yourself) added a
<ExcludeFoldersFromDeployment>Content\files</ExcludeFoldersFromDeployment>
line in the csproj file, and then forgot about it, and later you do want to publish the folder.Because of this line, none of the files in Content/files (and subfolders) will be deployed, even if the BuildAction is
Content
.This is hard to spot because, AFAIK, it is not visible anywhere in visual studio, you have to open the csproj file with a text editor.
就我而言,我看不到将文件的构建操作设置为内容的选项,因此我必须:
此外,请确保当您右键单击文件>时属性中,“复制到输出目录”设置为“始终复制”或“较新时复制”。
In my case I couldn't see the option to set files' Build Action to Content so I had to:
Also, make sure that when you right click on file > Properties, the "Copy to Output Directory" is set to either "Always Copy" or "Copy When Newer".