某些 Razor 视图未发布 [英] Certain Razor views not publishing

查看:24
本文介绍了某些 Razor 视图未发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 VS 2017 和 MVC 5 Razor 视图.当我发布我的应用程序时,一些特定的视图不会被复制.

Using VS 2017 with MVC 5 Razor views. When I publish my application, a handful of specific views do not get copied over.

我在 2010-2011 年的时间范围内发现了几个关于同一问题的 SE 问题.当时,问题是由于某些早期 RC 中的错误已解决,文件属性中的构建操作未设置为内容.好吧,我的所有人都天构建行动的内容.

I'd discovered several SE questions on this same issue from back in the 2010-2011 timeframe. At the time, the issue was that Build Action in the file's properties was not set to Content due to a bug in some early RC which has since been resolved. Well, all of mine already do day Content for Build Action.

为什么只有少数浏览量没有出现在发布中?

Any reason why only a small number of views are not making it in the publish?

推荐答案

据我所知,只有两件事会导致这种情况发生.

As far as I'm aware, there are only 2 things that can cause this to happen.

  1. 正如您在问题中所说,每个视图的构建操作都需要设置为内容"
  2. 视图文件需要包含在项目文件中,所以在.csproj文件中应该有这样一行:

  1. As you say in the question, the build action for each view needs to be set to "Content"
  2. The view files need to be included in the project file, so in the .csproj file there should be a line like this:

<Content Include="ViewsControllerNameIndex.cshtml" />

这篇关于某些 Razor 视图未发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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