title: Getting the Content item from a csproj using the MSBuild task
body: <p>I have an MSBuild file and I am building C# projects like this:</p>
  
  <pre><code>&lt;ItemGroup&gt;
      &lt;ProjectsToBuild Include="./source/ProjectA/ProjectA.csproj"/&gt;
      &lt;ProjectsToBuild Include="./source/ProjectB/ProjectB.csproj"/&gt;
  &lt;/ItemGroup&gt;
  
  &lt;Target Name="Build"&gt;
      &lt;MSBuild Projects="@(ProjectsToBuild)" Targets="Build"&gt;
          &lt;Output ItemName="ProjectOutputs" TaskParameter="TargetOutputs"/&gt;
      &lt;/MSBuild&gt;
      &lt;Message Text="@ProjectOutputs"/&gt;
  &lt;/Target&gt;
  </code></pre>
  
  <p>I successfully get an Item containing all of the .dll files that were built:</p>
  
  <pre><code>Build:
      c:\code\bin\ProjectA.dll;c:\code\bin\ProjectB.dll
  </code></pre>
  
  <p>I would also like to get the Content item from each project without modifying the .csproj files. After digging around in the Microsoft .targets files, I was almost able to get it working with this:</p>
  
  <pre><code>&lt;MSBuild Projects="@(ProjectsToBuild)" Targets="ContentFilesProjectOutputGroup"&gt;
      &lt;Output ItemName="ContentFiles" TaskParameter="TargetOutputs"/&gt;
  &lt;/MSBuild&gt;
  &lt;Message Text="@(ContentFiles-&gt;'%(RelativeDir)')"/&gt;
  </code></pre>
  
  <p>The problem with this approach is the RelativeDir is not being set correctly. I am getting the full path instead of relative:</p>
  
  <pre><code>Build:
      c:\ProjectA\MyFolder\MyControl.ascx;c:\ProjectB\MyOtherFolder\MyCSS.css;
  </code></pre>
  
  <p>instead of:</p>
  
  <pre><code>Build:
      MyFolder\MyControl.ascx;MyOtherFolder\MyCSS.css;
  </code></pre>
  
  <p>Is there a property I can pass to the MSBuild task that will make RelativeDir behave correctly?</p>
  
  <p>Or, even better, is there an easier way to get the Content item?</p>