Categories
Articles

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

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

It turns out that MSBuild will fail the whole build when you’re running it from the command line if there’s not a file inside the project that it can build.  

The project in question was 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, though you can name it anything you like. The CS2008: No inputs specified error is only complaining about not having a file to build, so it can be any valid C# file.:

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.
  }
}