<p>In MSBuild, I would like to call a task that extracts all the files in all the project in a specific solution and hold these files in a property that can be passed around to other tasks (for processing etc.)</p>

<p>I was thinking something along the lines of:</p>

<pre><code>&lt;ParseSolutionFile SolutionFile="$(TheSolutionFile)"&gt;
  &lt;Output TaskParameter="FilesFound" ItemName="AllFilesInSolution"/&gt;
&lt;/ParseSolutionFile&gt;

&lt;Message Text="Found $(AllFilesInSolution)" /&gt;
</code></pre>

<p>which would output the list of all files in the projects in the solution and I could use the AllFilesInSolution property as input to other analysis tasks. Is this an already existing task or do I need to build it myself? If I need to build it myself, should the task output an array of strings or of ITaskItems or something else?</p>

I don't know about tasks, but there are already properties that hold all items. Just look in your typical project file and you'll see which collection they're being added to.
Note the properties
Content
,
Compile
,
Folder
... any time you add a file to a project, it gets put in one of the main collections like this:
```
```
<ItemGroup>
  <Content Include="Default.aspx" />
  <Content Include="Web.config" />
</ItemGroup>
<ItemGroup>
  <Compile Include="Default.aspx.cs">
    <SubType>ASPXCodeBehind</SubType>
    <DependentUpon>Default.aspx</DependentUpon>
  </Compile>
  <Compile Include="Default.aspx.designer.cs">
    <DependentUpon>Default.aspx</DependentUpon>
  </Compile>
</ItemGroup>
<ItemGroup>
  <Folder Include="App_Data\" />
</ItemGroup>
```
```
Then you can do stuff like this to put the values from existing properties into your properties (the Condition attribute acts as a filter):
```
```
<CreateItem Include="@(Content)" Condition="'%(Extension)' == '.aspx'">
    <Output TaskParameter="Include" ItemName="ViewsContent" />
</CreateItem>
```
```
Or you can do it manually (the Include attribute uses the existing property OutputPath, but it indicates a path that inclues all files):
```
```
<CreateItem Include="$(OutputPath)\**\*">
  <Output TaskParameter="Include" ItemName="OutputFiles" />
</CreateItem>
```
```
There are more details in the MSDN MSBuild documentation that I read when I was mucking with custom build tasks and stuff that was very helpful. Go read up on the CreateItem task and you'll be able to make more sense out of what I posted here. It's really easy to pick up on.