Today I was setting up an automated build using TeamCity and came across an issue where the build of the solution kept failing.  The only reason that was given was this:

[MSBuild output] CSC : fatal error CS2008: No inputs specified

Turns out that MSBuild actually fails the whole build when you’re running it from the command line like this if there’s not a file that it can build.  The project in question was actually just full of XML and configuration files that other projects referenced and got published with a NuGet package to our private feed.  To fix it, I just added a simple .cs file, so that MSBuild had something to do.  🙂

Here’s the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Configuration
class MSBuildBugFix
// MSBuild has a bug where if no source files are found, the build fails when
// running from the commandline (or in our case, TeamCity). This file is only here
// to allow the build to complete.