Welcome to MSDN Blogs Sign in | Join | Help

Build tips of TeamBuild scripts

 

  • MS Build evaluates the condition of the target first and then do the dependency check. For example, in the mentioned proj file, target "B" will never be invoked.

 <Target Name="A"
         Condition="'false'= ='true'"
         DependsOnTargets="B">
                 <Message Text="A"/>
  </Target>

  <Target Name="B">
                 <Message Text="B"/>
  </Target>

  • Calling msbuild task inside the your proj file will invoke a new process. The child process (of msbuild task) will not inherit all the properties from the parent process. If you want to reuse the properties, you need to explicitly pass them using "Properties" tag of the task.
  • You can split the itemgroups based on attributes using CreateItem task.

  <ItemGroup>
         <ResxFile Include="dir1\Resources.resx"/>
         <ResxFile Include="dir2\Resources.resx">
             <OutputResource>dir2\objd\ClientResources.resources</OutputResource>
         </ResxFile>
  </ItemGroup>

  <Target Name="SplitResourcesByOutputAttribute">  
         <CreateItem Include="@(ResxFile)" Condition="'%(ResxFile.OutputResource)'= =''">
                <Output TaskParameter="Include" ItemName="ResxFilesWithoutAttribute"/>
         </CreateItem>
         <CreateItem Include="@(ResxFile)" Condition="'%(ResxFile.OutputResource)'!=''">
                <Output TaskParameter="Include" ItemName="ResxFileWithAttribute"/>
         </CreateItem>     
  </Target>

 

    Published Wednesday, July 27, 2005 7:06 PM by ManishAgarwal

    Comment Notification

    If you would like to receive an email when updates are made to this post, please register here

    Subscribe to this post's comments using RSS

    Comments

    No Comments

    Leave a Comment

    (required) 
    required 
    (required) 

      
    Enter Code Here: Required
     
    Page view tracker