SimpleLog/Versioning.targets

59 lines
2.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<Producer Condition="$(Producer) == ''">Tommy Montgomery</Producer>
<Copyright Condition="$(Copyright) == ''">Copyright (C) 2009 Tommy Montgomery</Copyright>
<MajorVersion Condition="$(MajorVersion) == ''">1</MajorVersion>
<MinorVersion Condition="$(MinorVersion) == ''">1</MinorVersion>
<BuildNumber Condition="$(BuildNumber) == ''">0</BuildNumber>
<RevisionNumber Condition="$(RevisionNumber) == ''">0</RevisionNumber>
<PropertiesDir>Properties</PropertiesDir>
<BuildDependsOn>
ConfigureVersionNumber;
CreateAssemblyInfo;
$(BuildDependsOn)
</BuildDependsOn>
</PropertyGroup>
<ItemGroup>
<AssemblyFile Include="$(PropertiesDir)\AssemblyInfo.cs"/>
<Compile Include="@(AssemblyFile)"/>
</ItemGroup>
<Target Name="GetSubversionInfo">
<Message Text="Getting revision information..."/>
<SvnInfo RepositoryPath=".">
<Output TaskParameter="LastChangedRevision" PropertyName="RevisionNumber"/>
</SvnInfo>
<Message Text="Last changed revision: $(RevisionNumber)"/>
</Target>
<Target Name="ConfigureVersionNumber" DependsOnTargets="GetSubversionInfo">
<CreateProperty Value="$(MajorVersion).$(MinorVersion).$(BuildNumber).$(RevisionNumber)">
<Output PropertyName="VersionNumber" TaskParameter="Value"/>
</CreateProperty>
<Message Text="Version number set to: $(VersionNumber)"/>
</Target>
<Target Name="CreateAssemblyInfo" DependsOnTargets="ConfigureVersionNumber">
<MakeDir Directories="$(PropertiesDir)"/>
<AssemblyInfo
OutputFile="@(AssemblyFile)"
CodeLanguage="CS"
AssemblyCompany="$(Producer)"
AssemblyConfiguration="$(Configuration)"
AssemblyCopyright="$(Copyright)"
AssemblyFileVersion="$(VersionNumber)"
AssemblyTitle="$(AssemblyName)"
AssemblyVersion="$(VersionNumber)"
/>
</Target>
<Target Name="AfterBuild">
<RemoveDir Directories="$(PropertiesDir)"/>
</Target>
</Project>