ASP.NET:发布网站不会发布资源文件夹 [英] ASP.NET: Publishing Website doesn't publish Resources folder

查看:152
本文介绍了ASP.NET:发布网站不会发布资源文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在使用ASP.NET开发的网站.我使用的是Visual Studio2015.右键单击并单击发布网站"时,网站会正确发布,只是我的资源文件夹被抛在了后面.这是解决方案资源管理器在Visual Studio中的外观

I have a website that I'm developing with ASP.NET. I'm using Visual Studio 2015. When I right-click and hit publish website the site publishes correctly except that my resources folder gets left behind. Heres what the solution explorer looks like in Visual Studio

但是,在我将其发布之后,这里是放置在Azure上的文件(可通过FileZilla访问)

But after I publish it here are the files that get put on Azure (accessed via FileZilla)

如何告诉Visual Studio与网站的其余部分一起发布Resources文件夹?

How do I tell Visual Studio to publish the Resources folder with the rest of the website?

推荐答案

可能的答案

  1. 打开解决方案资源管理器.
  2. 右键单击资源"目录中的文件之一.
  3. 选择属性.

您现在需要设置两个属性.

You now need to set two properties.

Build Action                      Content
Copy to Output Directory          Do not copy

对要作为内容发布到Web服务器的所有文件执行此操作.

Do this to all the files that you would like to publish as content to the web server.

构建操作属性指示在执行构建时,Visual Studio对文件进行的操作.Build Action可以具有以下值之一:

The Build Action property indicates what Visual Studio does with a file when a build is executed. Build Action can have one of several values:

  • 无. 不是您想要的.该文件不包含在项目输出组中,并且在构建过程中未进行编译.一个示例是一个文本文件,其中包含您不想发布到Web服务器的文档,例如自述文件.

  • None. Not what you want. The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file, that you do not want to publish to the web server.

编译. 不是您想要的.该文件被编译到构建输出中.此设置用于代码文件.换句话说,我们编译文件并将其粘贴到 bin 目录中.

Compile. Not what you want. The file is compiled into the build output. This setting is used for code files. In other words, we compile the file and the stick it into the bin directory.

内容. 这就是您想要的.该文件未编译,但包含在内容"输出组中.例如,此设置是.htm或其他类型的Web文件的默认值.内容输出组"是Visual Studio将发布的文件列表,同时还保持相同的目录结构.

Content. This is what you want. The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file. The "Content output group" is a list of files that Visual Studio will publish while also maintaining the same directory structure.

嵌入式资源. 不是您想要的.该文件作为DLL或可执行文件嵌入到主项目构建输出中.它通常用于资源文件.换句话说,它不仅进入 bin 目录,而且还嵌入到 .dll .exe 文件中.

Embedded Resource. Not what you want. This file is embedded in the main project build output as a DLL or executable. It is typically used for resource files. In other words, it not only goes into the bin directory but is also embedded within a .dll or .exe file.

复制到输出目录..此属性指定在什么条件下将所选源文件复制到输出目录.输出目录通常是 bin .

Copy to Output Directory. This property specifies the conditions under which the selected source file will be copied to the output directory. The output directory is normally the bin.

什么是";建立行动"Visual Studio项目属性中的设置,它们是做什么的?

MSDN上的文件属性

这篇关于ASP.NET:发布网站不会发布资源文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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