Team City build no longer including View changes, or published website showing a 404?

One of the websites I develop uses Team City as it’s CI / deployment tool. Up until today, it had successfully (except when it was my fault…) deployed over 200 builds. But today it stopped working.

If, like me, you pre-compile your ASP.NET website (PrecompileBeforePublish) and don’t delete old files (DeleteExistingFiles), you’ll see this problem manifest itself when changes you make to your View files aren’t reflected on your published website (even though they worked fine locally), where-as changes you make to Controllers and other C# files will do.

If you pre-compile your ASP.NET website but do delete old files, you’ll see this problem manifest itself either as above (if you don’t have a Global.asax file) or through your published website displaying 404’s for all your routes, bar those for static assets (CSS, JS, images etc.) if you do.

So, if you’re experiencing the symptoms I describe above, you might want to try disabling your anti-virus and trying again. No, I’m serious. After far too many hours debugging this issue, that was what was causing it for me; specifically, McAfee VirusScan Console’s “On-Access Scanner”. For those of you also screwed over by McAfee, I had to add the following .exe‘s to the list of “Low-Risk Processes”:

  • C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe (you may have to swap v4.0.30319 depending on the .NET version you’re using)
  • C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe (you may have to swap v4.0.30319 depending on the .NET version you’re using)
  • C:\TeamCity\buildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.MsBuildBootstrap.exe


When using PrecompileBeforePublish, Team City copies all files which need to be compiled into C:\TeamCity\buildAgent\work\[workHash]\[buildDir]\obj\[buildProfile]\AspnetCompileMerge\Source. It then invokes aspnet_compiler.exe on that directory, setting the output directory (targetDir in the aspnet_compiler.exe docs) to be ..\TempBuildDir (relative to the previous directory).

In my case, when checking ..\TempBuildDir, I noticed there were no *.compiled files or App_Web_*.dll‘s in the bin folder; the contents of this folder is used as a base for the published website, so none of those files mean no View files in your app! It therefore seems that McAfee blocks them files from being written to disk, for whatever reason.

In summary; disable your anti-virus!