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

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

问题描述

我有一个使用 ASP.NET 开发的网站.我正在使用 Visual Studio 2015.当我右键单击并点击发布网站时,该站点可以正确发布,只是我的资源文件夹被遗忘了.这是 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.

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

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天全站免登陆