Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retrieve @(TargetOutputs) without performing a build

I'm implementing an MSBuild framework to drive the building and deployment of many projects organized as a hierarchy.

<Target Name="_CoreBuild">
  <MSBuild Projects="@(Project)" Targets="Build" Properties="Configuration=$(Configuration)">
    <Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" />
  </MSBuild>
</Target>

In order to implement proper Clean/Clobber logic, I would like to retrieve the list of files that would be compiled if a build were performed with the current options.

<Target Name="_CoreClobber" DependsOnTargets="_CoreClean">
   <!-- How to retrieve @(CompiledAssemblies) as if we were
        building @(Project) and retrieving the @(TargetOutputs) item group.
     -->
</Target>

I've tried various methods, including creating a custom task, in which I build a custom project file that imports the original project I want to retrieve the properties/items from. But that does not give me reliable values.

Is there a way to retrieve an MSBuild project's TargetOutputs item group without actually performing a build?

like image 542
Maxime Labelle Avatar asked Oct 19 '11 15:10

Maxime Labelle


1 Answers

Never mind.

I stumbled upon the following similar question, and figured I had to use the GetTargetPath target, like so:

<Target Name="_CoreBuild">
  <MSBuild Projects="@(Project)" Targets="GetTargetPath" Properties="Configuration=$(Configuration)">
    <Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" />
  </MSBuild>
</Target>
like image 160
Maxime Labelle Avatar answered Oct 17 '22 19:10

Maxime Labelle