I set up a Jenkins build server at work to compile a solution on every commit. I prefer the build to run from a clean state every time, so I was using the Rebuild (Clean and Build) target.
msbuild.exe /t:Rebuild MySolution.sln rem ... lots of compilation output rem ...The "CreateRiaClientFilesTask" task failed unexpectedly.
Puzzled, I tried some different conditions and found that if I ran Build twice without Clean, I would usually get the second build to pass.
msbuild.exe /t:Build MySolution.sln rem ... lots of compilation output rem ...The "CreateRiaClientFilesTask" task failed unexpectedly.
msbuild.exe /t:Build MySolution.sln rem ... lots of compilation output rem ...Build Successful.
But this isn’t what anyone signs up for with a build server. The idea is to have a repeatable process you trust producing artifacts you can believe in.
Excluding Temporary ASP.NET Files
As it turns out, the problem was McAfee’s On Access Scan. This process sits on the Windows build server and watches folders for writes, scanning files shortly there after. In the case of ASP.NET, incremental compilation happens within the folders
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\
Excluding that directory and subdirectories from the McAfee On Access Scan (in group policy!) eliminated our flaky compilation issues.
2014-07-25: Added summary and syntax highlighting to msbuild examples.