简体   繁体   中英

How to build solutions list in multiple properties file using msbuild?

I am having following list of Msbuild properties file.

C:\\Build\\Mainscript\\Master.targets

C:\\Build\\Mainscript\\Master.properties

C:\\Build\\Component1\\build.comp1.properties

C:\\Build\\Component2\\build.comp2.properties

         .
         .

C:\\build\\Component3\\build.compn.properties

Component1.properties has list of solutions like follows

<Solution Include="C:\build\Component1\Mysoltuion.sln;">
      <Group>Firstcomp</Group>
      <AdditionalProperties>
        ValidateXaml=false;
        ReferencePath=$(DefaultReference);
      </AdditionalProperties>
      <IsRebuild>False</IsRebuild>
    </Solution>   

Component2.properties has list of solutions like follows

<Solution Include="C:\build\Component2\Mysoltuion.sln;">
      <Group>Firstcomp</Group>
      <AdditionalProperties>
        ValidateXaml=false;
        ReferencePath=$(DefaultReference);
      </AdditionalProperties>
      <IsRebuild>False</IsRebuild>
    </Solution>   

Master.properties will have common properties for all components.

<Components Include="C:\Build\Comp1\Build.comp1.properties">
      <ComponentName>Comp1</ComponentName>
    </Components>

    <Components Include="C:\Build.CompN.Properties">
      <ComponentName>CompN</ComponentName>
    </Components>

I am having a target as follows which is helping me to build all components

  <Target Name="BuildAll" Inputs="@(Components)" Outputs="%(Identity).Dummy">

    <MSBuild Projects="@(Components)"

             Targets="BuildComponent" />

  </Target>

I want to build some particular components alone most of the time. How to pass particular components alone.

See the answer to your similar question here:
How to pass items one by one to another msbuild task?

Basically, you can access custom metadata for each item in an ItemGroup like this:

<Target Name="BuildAll" Inputs="@(Components)" Outputs="%(Identity).Dummy">
    <MSBuild Projects="%(Identity)" 
             Targets="%(ComponentName)" />
</Target>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM