2

We have an ASP.NET MVC application that we build on VSTS. When a csproj file is referencing a missing cshtml file (ie it's not on disk, but is in the csproj file), we can still build locally. But the VSTS build fails.

Any idea what could be the cause of this weird behavior? I'd expect the local (Visual Studio) build to fail too.

I've tried it by building with the msbuild command line, but no difference there.

I've seen this question but don't want to have to start messing with my csproj file. I want both Visual Studio and VSTS to show the same behavior.

Peter
  • 13,733
  • 11
  • 75
  • 122
  • Which behaviour is the desired behaviour? Do you want VSTS to fail, or do you want local builds to fail? Do you build in `RELEASE` in both places? – Paul Suart Jun 25 '18 at 10:06
  • 1
    This article may help https://blogs.msdn.microsoft.com/jimlamb/2010/04/20/turn-on-compile-time-view-checking-for-asp-net-mvc-projects-in-tfs-build-2010/ – labilbe Jun 25 '18 at 10:08
  • Ideally, it would fail in both cases. Building in Release in both cases. – Peter Jun 25 '18 at 11:13
  • @labilbe's suggestion is a good one. We do the same thing. It doesn't adequately explain the discrepancy, and yes, you have to change your project file. – Paul Suart Jun 25 '18 at 11:58
  • 1
    @labilbe if you add that as an answer, I'll approve it. – Peter Jun 26 '18 at 12:54

1 Answers1

1

Turning Compile-time View Checking for ASP.NET MVC Projects should resolve the case.

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

labilbe
  • 3,501
  • 2
  • 29
  • 34