c# - 当 cshtml 文件丢失时,VS2017 构建不会失败; VSTS 确实失败

标签 c# asp.net-mvc visual-studio razor azure-devops

我们有一个基于 VSTS 构建的 ASP.NET MVC 应用程序。当 csproj 文件引用丢失的 cshtml 文件时(即它不在磁盘上,但在 csproj 文件中),我们仍然可以在本地构建。但是 VSTS 构建失败。

知道这种奇怪行为的原因是什么吗?我预计本地 (Visual Studio) 构建也会失败。

我试过用 msbuild 命令行构建,但没有区别。

我看过 this question但不想开始弄乱我的 csproj 文件。我希望 Visual Studio 和 VSTS 显示相同的行为。

最佳答案

为 ASP.NET MVC 项目启用编译时 View 检查应该可以解决这个问题。

参见 https://blogs.msdn.microsoft.com/jimlamb/2010/04/20/turn-on-compile-time-view-checking-for-asp-net-mvc-projects-in-tfs-build-2010/

关于c# - 当 cshtml 文件丢失时,VS2017 构建不会失败; VSTS 确实失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51020820/

相关文章:

c++ - 如何编写一个将字符串和整数读入两个单独的动态数组的程序?

c# - Caliburn.Micro - ShowDialog() 如何关闭对话框?

asp.net-mvc - 类库中的 Controller 和 View

asp.net-mvc - MVC .NET 的 CanCan gem

c# - 如何在调试时刷新 Excel

visual-studio - 在 Visual Studio 2015 中找不到我的 "Find in Files"窗口

c# - 使用 Mysqldatareader 访问行

c# - 无法将类型 'system.windows.forms.textbox' 的对象转换为类型 'System.IConvertible' 错误

c# - TPL 数据流加速?

.net - ActionFilterAttribute 不重定向