Output all files from the MSBuild task solution

In MSBuild, I would like to call a task that retrieves all the files in the entire project in a specific solution and holds these files in a property that can be transferred to other tasks (for processing, etc.).

I thought something like:

<ParseSolutionFile SolutionFile="$(TheSolutionFile)">
  <Output TaskParameter="FilesFound" ItemName="AllFilesInSolution"/>
</ParseSolutionFile>

<Message Text="Found $(AllFilesInSolution)" />

which lists all the files in the projects in the solution, and I could use the AllFilesInSolution property as input for other analysis tasks. Is this an existing task or do I need to create one myself? If I need to create it myself, should the task output an array of strings or ITaskItems or something else?

+3
source share
2 answers

, , . , , .

, , ... :

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

, ( Condition ):

<CreateItem Include="@(Content)" Condition="'%(Extension)' == '.aspx'">
    <Output TaskParameter="Include" ItemName="ViewsContent" />
</CreateItem>

( Include OutputPath, , ):

<CreateItem Include="$(OutputPath)\**\*">
  <Output TaskParameter="Include" ItemName="OutputFiles" />
</CreateItem>

MSDN MSBuild , , , . CreateItem, , . .

+2

SSRS ( TFS w/o vs, ). , RDL , .

<Target Name="CopyArtifactstoDropLocation">
  <CreateItem Include="$(SolutionRoot)\**\*.*">
    <Output TaskParameter="Include" ItemName="YourFilesToCopy" />
  </CreateItem>

  <Copy
    SourceFiles="@(YourFilesToCopy)"
    DestinationFiles="@(YourFilesToCopy->'$(DropLocation)\$(BuildNumber)\Release\%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

, . , , TFS, , .

0

Source: https://habr.com/ru/post/1699038/


All Articles