Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild MSBuildCommunityTasks Task Time

I have a MSBuild project and I want the current date to be added to a zip file that I am creating.

I am using the MSBuildCommunityTasks.

<!-- Import the CommunityTasks Helpper -->
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />

On the website http://msbuildtasks.tigris.org/ I can see a task called time. I have not been able to find doc on how to use Time.

like image 762
Eric Brown - Cal Avatar asked May 18 '09 14:05

Eric Brown - Cal


2 Answers

In msbuild 4 you can now

$([Namespace.Type]::Method(..parameters…))
$([Namespace.Type]::Property)
$([Namespace.Type]::set_Property(value))

so I am using

$([System.DateTime]::Now.ToString(`yyyy.MMdd`))

those ticks around the format are backticks not '

like image 83
Maslow Avatar answered Oct 06 '22 19:10

Maslow


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

<Project DefaultTargets="Deploy" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>

  <!-- Include MSBuild tasks here -->

  <ItemGroup>     
      <DefaultExclude Include="****" />           
  </ItemGroup>


 <Target Name="Deploy" >

    <Time Format="yyyy-MM-dd">
    <Output TaskParameter="FormattedTime" PropertyName="buildDate" />
    </Time>

    <Message Text="Deploying ...."></Message>   

    <Copy  SourceFiles="@(DeploymentFiles)" DestinationFolder="C:\CCNET\$(buildDate)\bin\" />

</Target>

</Project>
like image 37
abmv Avatar answered Oct 06 '22 18:10

abmv