title: In MsBuild, what's the difference between PropertyGroup and ItemGroup
body: <p>I can compile a <code>.cs</code> file referenced by <code>PropertyGroup</code>:</p>
  
  <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
      &lt;PropertyGroup&gt;
          &lt;AssemblyName&gt;MSBuildSample&lt;/AssemblyName&gt;
          &lt;OutputPath&gt;Bin\&lt;/OutputPath&gt;
          &lt;Compile&gt;helloConfig.cs&lt;/Compile&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;Target Name="Build"&gt;
          &lt;MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" /&gt;
          &lt;Csc Sources="$(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe"/&gt;
      &lt;/Target&gt;        
  &lt;/Project&gt;
  </code></pre>
  
  <p>or do the same thing using ItemGroup:</p>
  
  <pre><code>&lt;Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;    
      &lt;ItemGroup&gt;
          &lt;Compile Include="helloConfig.cs" /&gt;
      &lt;/ItemGroup&gt;
  
      &lt;PropertyGroup&gt;
          &lt;AssemblyName&gt;MSBuildSample&lt;/AssemblyName&gt;
          &lt;OutputPath&gt;Bin\&lt;/OutputPath&gt;
      &lt;/PropertyGroup&gt;
  
      &lt;Target Name="Build"&gt;
          &lt;MakeDir Directories="$(OutputPath)" Condition="!Exists('$(OutputPath)')" /&gt;
          &lt;Csc Sources="@(Compile)" OutputAssembly="$(OutputPath)$(AssemblyName).exe"/&gt;
      &lt;/Target&gt;  
  &lt;/Project&gt;
  </code></pre>
  
  <p>I know that using <code>ItemGroup</code> should be the preferred method, but what's when I should use each one of these properties?</p>