ASP.NET:发布网站不会发布资源文件夹

编程入门 行业动态 更新时间:2024-10-20 20:58:33
本文介绍了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?

推荐答案

可能的答案

  • 打开解决方案资源管理器.
  • 右键单击资源"目录中的文件之一.
  • 选择属性.
  • 您现在需要设置两个属性.

    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:发布网站不会发布资源文件夹

    本文发布于:2023-11-07 11:03:49,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1566278.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:文件夹   资源   网站   ASP   NET

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!