Pages

Friday, February 1, 2013

MSBuild Sample



xml version="1.0" encoding="utf-8"?>

<Project ToolsVersion="4.0" DefaultTargets="Main" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
  <PropertyGroup>
    <Source>.\Source\</Source>
    <Exported>.\Exported\</Exported>
    <TargetFolder>C:\Temp\Build\SampleA</TargetFolder>
    <ProjectGuid>{8170B353-A8B2-40BC-B4E5-F443635E3BA4}</ProjectGuid>
  </PropertyGroup>
 
  <PropertyGroup Condition="'$(Configuration)' == 'Main'">
    <OutputPath>bin\Main\</OutputPath>
  </PropertyGroup>
 
  <PropertyGroup Condition="'$(Configuration)' == 'Variable-Samples'">
    <OutputPath>bin\Variable-Samples\</OutputPath>
  </PropertyGroup>
 
  <ItemGroup>
    <AllSource Include="$(Source)**\*.*" />
    <AllExportedSource Include="$(Exported)**\*.*" />
  </ItemGroup>
 
  <Target Name="Main">
    <CallTarget Targets="Variable-Samples" />
   
   
  </Target>
 
  <Target Name="Clean">
    <Message Text="###################### Clean has been called #####################">
    </Message>
    <RemoveDir Directories="$(Exported)" ContinueOnError="true">
    </RemoveDir>
    <MakeDir Directories="$(Exported)" ContinueOnError="true">
    </MakeDir>
    <RemoveDir Directories="$(TargetFolder)" ContinueOnError="true">
    </RemoveDir>
    <MakeDir Directories="$(TargetFolder)" ContinueOnError="true">
    </MakeDir>
    <Message Text="###################### Clean has been finished #####################">
    </Message>
  </Target>
 
  <Target Name="Export" DependsOnTargets="Clean">
    <Exec Command="svn export file:///C:/SVN-REP/MSBUILD-TEST/trunk/Clips.WebClientNewDesign/Templates $(Exported)Source-Tempaltes/">
    </Exec>
  </Target>
 
  <Target Name="Deploy" DependsOnTargets="Clean">
    <Message Text="###################### Deployed has been called #####################" />
    <Copy SourceFiles="@(AllExportedSource)" DestinationFolder="$(TargetFolder)\**\*.*" />
    <Message Text="###################### Deployed has been finished #####################" />
  </Target>
 
  <Target Name="Variable-Samples">
   
    <PropertyGroup>
      <Source Condition="false">.\New-Source\</Source>
    </PropertyGroup>
    <Message Text="Source value= $(Source)">
    </Message>
    <CreateProperty Value="Hello Oz">
      <Output TaskParameter="Value" PropertyName="Greating" />
    </CreateProperty>
    <Message Text="Greating :$(Greating)">
    </Message>
   
    <CreateProperty Value="Hello World">
      <Output TaskParameter="Value" PropertyName="Greating" />
    </CreateProperty>
    <Message Text="Greating :$(Greating)">
    </Message>
    <CreateProperty Value="Hello Entire world">
      <Output TaskParameter="Value" PropertyName="Greating" Condition="true" />
    </CreateProperty>
    <Message Text="Greating :$(Greating)">
    </Message>
  </Target>
 
  <Target Name="Config-Target">
   
   
   
    <Message Text="Config value= $(Configuration)">
    </Message>
    <CreateProperty Value="DEV">
      <Output TaskParameter="Value" PropertyName="Type" />
    </CreateProperty>
  </Target>

  <Target Name="Metadata" DependsOnTargets="Export">
    <ItemGroup>
      <AllSource Include="$(Source)**\*.*" />
      <AllExportedSource Include="$(Exported)**\*.*" />
    </ItemGroup>
   
   
   
   
   
    <Message Text="All exported source : @(AllExportedSource->'%(RecursiveDir)%(Filename)%(Extension)%0D%0A')"></Message>
  
  </Target>
</Project>


No comments:

Post a Comment