Microsoft.Web.Publishing.targets 处的 BeforeTargets 属性中列出的目标 MvcBuildViews 在项目中不存在,将被忽略

The target MvcBuildViews listed in a BeforeTargets attribute at Microsoft.Web.Publishing.targets does not exist in the project, and will be ignored

在 TeamCity 构建中,我看到一堆(大约 80 到 120 行)看起来与下面完全相同的行(只有时间戳发生变化),我不知道它们做了什么或如何解决它们(构建总共成功):

[05:58:44][Step 1/3] The target "MvcBuildViews" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets (839,131)" does not exist in the project, and will be ignored.

或者,更短的形式,没有记录器的垃圾:

The target "MvcBuildViews" listed in a BeforeTargets attribute at Microsoft.Web.Publishing.targets (839,131) does not exist in the project, and will be ignored.

除了奇怪的是它们完全出现并且一遍又一遍地重复,最近在列表中间的某个地方,时间差距很大:

[05:58:44][Step 1/3] The target "MvcBuildViews" [...]
[06:19:38][Step 1/3] The target "MvcBuildViews" [...]

我们的构建 运行 总共需要 30 分钟,而不是 "normal" 5 分钟左右。

我在谷歌上搜索这条消息根本没有找到任何结果,所以我估计我解决这个问题的机会相当渺茫,但如果有人以前遇到过这个问题并且知道是什么原因造成的,我会 非常想知道一个决议。

这个项目是用 VS 2010 构建的(是的,我们需要更新,真的),TeamCity 的版本是 9.1.3。

PS:关于此警告可能包含的内容(除了明显与 MVC 相关的内容)以及从何处开始寻找解决方案的提示当然同样受欢迎;)

我的一个项目遇到了同样的问题。在我的特定情况下,它是由我的 csproj 文件中缺少 'Target' 元素引起的。将以下内容添加到 csproj 的底部解决了这个问题。

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
  <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>