1 <?xml version="1.0" encoding="utf-8"?>
2 <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
3 <!-- Import this .targets file to automaticaly generate AssemblyVersion
4 attribute according to DotNetOpenAuth convention. -->
6 <ProjectRoot Condition="'$(ProjectRoot)' == ''">$(MSBuildProjectDirectory)\..\..</ProjectRoot>
7 <VersionCsFile>$(ProjectRoot)\obj\$(Configuration)\$(AssemblyName).Version.cs</VersionCsFile>
10 <Import Project="$(ProjectRoot)\lib\DotNetOpenId.BuildTasks.targets" />
11 <UsingTask AssemblyFile="$(ProjectRoot)\lib\MSBuild.Community.Tasks.dll" TaskName="AssemblyInfo"/>
13 <Target Name="GetBuildVersion">
14 <GetBuildVersion VersionFile="$(ProjectRoot)\src\version.txt" Condition=" '$(BuildVersion)' == '' ">
15 <Output TaskParameter="Version" PropertyName="BuildVersion" />
17 <Message Text="Building version $(BuildVersion)"/>
20 <Target Name="BeforeBuild" DependsOnTargets="GetBuildVersion">
22 <NewVersionCsFile>$(VersionCsFile).new</NewVersionCsFile>
24 <MakeDir Directories="$(ProjectRoot)\obj\$(Configuration)"/>
25 <AssemblyInfo OutputFile="$(NewVersionCsFile)" CodeLanguage="C#" AssemblyVersion="$(BuildVersion)" />
26 <!-- Avoid applying the newly generated AssemblyInfo.cs file to the build
27 unless it has changed in order to allow for incremental building. -->
28 <CompareFiles OriginalItems="$(VersionCsFile)" NewItems="$(NewVersionCsFile)">
29 <Output TaskParameter="AreChanged" PropertyName="AssemblyInfoChanged" />
31 <Copy Condition=" '$(AssemblyInfoChanged)' == 'true' " SourceFiles="$(NewVersionCsFile)" DestinationFiles="$(VersionCsFile)" />
33 <Compile Include="$(VersionCsFile)" />