title: MSBuild - Including References
body: <p>I'm trying to learn MSBuild; and to begin I have a C# project file that looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  
    &lt;PropertyGroup&gt;
      &lt;RootNamespace&gt;$(MSBuildProjectName)&lt;/RootNamespace&gt;
      &lt;AssemblyName&gt;$(MSBuildProjectName)&lt;/AssemblyName&gt;
      &lt;TargetFrameworkVersion&gt;v4.5.1&lt;/TargetFrameworkVersion&gt;
      &lt;FileAlignment&gt;512&lt;/FileAlignment&gt;
      &lt;AutoGenerateBindingRedirects&gt;true&lt;/AutoGenerateBindingRedirects&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Compile Include="**\*.cs" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;Reference Include="System" /&gt;
      &lt;Reference Include="System.Core" /&gt;
      &lt;Reference Include="System.Xml.Linq" /&gt;
      &lt;Reference Include="System.Data.DataSetExtensions" /&gt;
      &lt;Reference Include="Microsoft.CSharp" /&gt;
      &lt;Reference Include="System.Data" /&gt;
      &lt;Reference Include="System.Xml" /&gt;
    &lt;/ItemGroup&gt;
  
    &lt;Target Name="Build"&gt;
      &lt;Csc 
        AdditionalLibPaths="C:\Windows\Microsoft.NET\Framework\v4.0.30319\" 
        References="@(Reference)"
        Sources="@(Compile)" 
        OutputAssembly="$(MSBuildProjectName).exe" 
        /&gt;
    &lt;/Target&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>However, CSC fails, saying it can't find the metadata file 'xyz', once for each reference that I've tried to include. Additionally, Visual Studio reports a similar problem:</p>
  
  <p><img src="https://i.stack.imgur.com/qxYTt.png" alt="MSBuild References Problem"></p>
  
  <p>So what am I doing wrong?</p>