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

查看:72
本文介绍了某些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="Views\ControllerName\Index.cshtml" />

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

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