Permalink
Browse files

Project refactoring, added AssemblyFileVersion from the build.

  • Loading branch information...
1 parent e4441c8 commit 74993b6bd819ce4702e8633d094c420181887411 @jkowalski committed Jun 13, 2011
View
@@ -201,6 +201,13 @@ if (%1)==(label) (
goto next
)
+if (%1)==(ccnetlabel) (
+ set MSBUILD_ARGUMENTS=%MSBUILD_ARGUMENTS% /p:CCNetLabel=%2
+ shift
+ shift
+ goto next
+)
+
if (%1)==(buildpath) (
set MSBUILD_ARGUMENTS=%MSBUILD_ARGUMENTS% /p:BaseOutputDirectory=%2
shift
@@ -273,6 +280,7 @@ echo xsd NLog.xsd Intellisense files
echo installer Installer
echo tools Tools
echo label {suffix} Define build label (defaults to 'PrivateBuild')
+echo ccnetlabel {label} Override CCNetLabel
echo buildpath {dir} Set build directory.
exit /b 1
@@ -49,4 +49,9 @@
</ProjectReference>
</ItemGroup>
<Import Project="..\..\src\Mono.targets" />
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
</Project>
@@ -59,4 +59,9 @@
<Target Name="AfterBuild">
</Target>
-->
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
</Project>
@@ -101,4 +101,9 @@
<Target Name="AfterBuild">
</Target>
-->
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
</Project>
@@ -63,4 +63,9 @@
<Target Name="AfterBuild">
</Target>
-->
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
</Project>
@@ -81,4 +81,9 @@
</ProjectReference>
</ItemGroup>
<Import Project="..\Mono.targets" />
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -83,4 +83,9 @@
<Name>NLog.monodevelop</Name>
</ProjectReference>
</ItemGroup>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
</Project>
@@ -79,4 +79,9 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -88,4 +88,9 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -91,4 +91,9 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
View
@@ -12,7 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.UnitTests.netfx20", ".
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleExtensions.netfx20", "..\tests\SampleExtensions\SampleExtensions.netfx20.csproj", "{1653EE05-2720-4A85-BF14-74C4593787B1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallNLogConfig.netfx20", "..\tools\InstallNLogConfig\InstallNLogConfig.netfx20.csproj", "{0CF95BE4-0546-4CE9-AB49-B9E5DA599EAA}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallNLogConfig.netfx20", "InstallNLogConfig\InstallNLogConfig.netfx20.csproj", "{0CF95BE4-0546-4CE9-AB49-B9E5DA599EAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Extended.netfx20", "NLog.Extended\NLog.Extended.netfx20.csproj", "{F801A1F9-1024-4446-BF9E-A923137340B8}"
EndProject
View
@@ -16,7 +16,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.BinaryCompatTests.netf
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleExtensions.netfx35", "..\tests\SampleExtensions\SampleExtensions.netfx35.csproj", "{A8CA32F1-BD4C-4A99-B307-99A93DB64B9F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallNLogConfig.netfx35", "..\tools\InstallNLogConfig\InstallNLogConfig.netfx35.csproj", "{0CF95BE4-0546-4CE9-AB49-B9E4DA59AEAA}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallNLogConfig.netfx35", "InstallNLogConfig\InstallNLogConfig.netfx35.csproj", "{0CF95BE4-0546-4CE9-AB49-B9E4DA59AEAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Extended.netfx35", "NLog.Extended\NLog.Extended.netfx35.csproj", "{F801A1F9-1024-4446-BF9E-A923137340B8}"
EndProject
View
@@ -12,7 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.UnitTests.netfx40", ".
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleExtensions.netfx40", "..\tests\SampleExtensions\SampleExtensions.netfx40.csproj", "{FE067913-E9A8-41F0-89FA-C1136F8FB6A8}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallNLogConfig.netfx40", "..\tools\InstallNLogConfig\InstallNLogConfig.netfx40.csproj", "{0CF95BE4-0546-4CE9-AB49-B9E4DA599EAA}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InstallNLogConfig.netfx40", "InstallNLogConfig\InstallNLogConfig.netfx40.csproj", "{0CF95BE4-0546-4CE9-AB49-B9E4DA599EAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog.Extended.netfx40", "NLog.Extended\NLog.Extended.netfx40.csproj", "{A961A1F9-1024-4446-BF9E-A923137340B8}"
EndProject
View
@@ -1,14 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <BuildLabel>PrivateBuild</BuildLabel>
+ <BuildLabel Condition=" '$(CCNetLabel)'!='' ">$(CCNetLabel)</BuildLabel>
+ <BuildVersion>2.0.0.9999</BuildVersion>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="'$(CCNetLabel)' != '' and '$(MSBuildToolsVersion)'!='3.5'">
+ <BuildVersion>2.0.$(CCNetLabel.Substring(3,1))$(CCNetLabel.Substring(5,2))$(CCNetLabel.Substring(8,2)).$(CCNetLabel.Substring(11,3))</BuildVersion>
+ </PropertyGroup>
+
<PropertyGroup>
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
<BaseOutputDirectory>$(MSBuildProjectDirectory)\..\build\</BaseOutputDirectory>
<ProjectTarget Condition="'$(ProjectTarget)'==''">Build</ProjectTarget>
<FrameworksPath>$(MSBuildProjectDirectory)\Frameworks</FrameworksPath>
- <BuildLabel>PrivateBuild</BuildLabel>
- <BuildLabel Condition=" '$(CCNetLabel)'!='' ">$(CCNetLabel)</BuildLabel>
- <BuildVersion>0.0.0.0</BuildVersion>
<BuildAllFrameworks>true</BuildAllFrameworks>
<BuildAllFrameworks Condition="'$(BuildMono2)' == 'true'">false</BuildAllFrameworks>
<BuildAllFrameworks Condition="'$(BuildSL2)' == 'true'">false</BuildAllFrameworks>
@@ -38,6 +45,7 @@
<ConfigurationSuffix Condition="'$(Configuration)' == 'Debug'">-debug</ConfigurationSuffix>
<WebsiteDir Condition="'$(WebsiteDir)' == ''">$(BaseOutputDirectory)\bin\$(Configuration)\Website</WebsiteDir>
<LastTestRunSummary>$(BaseOutputDirectory)\bin\LastTestRunSummary.cmd</LastTestRunSummary>
+ <BuildInfoFile>$(BaseOutputDirectory)\obj\BuildInfo.cs</BuildInfoFile>
</PropertyGroup>
<!-- detect location of various SDKs and tools-->
@@ -188,22 +196,44 @@
</Target>
<Target Name="Build">
+ <PropertyGroup>
+ <BuildInfoFileContent>
+#if !NET_CF
+
+// automatically generated
+[assembly: System.Reflection.AssemblyFileVersion("$(BuildVersion)")]
+
+#endif
+
+</BuildInfoFileContent>
+ </PropertyGroup>
+
+ <MakeDir Directories="$(BaseOutputDirectory)\obj" />
+
+ <ReadLinesFromFile File="$(BuildInfoFile)" Condition="Exists('$(BuildInfoFile)')">
+ <Output TaskParameter="Lines" ItemName="CurrentBuildInfoFileContent" />
+ </ReadLinesFromFile>
+
+ <WriteLinesToFile File="$(BuildInfoFile)"
+ Lines='$(BuildInfoFileContent)'
+ Overwrite="true"
+ Condition="'$(BuildInfoFileContent)' != '@(CurrentBuildInfoFileContent)' " />
<MSBuild Projects="NLog\NLog%(TargetFramework.ProjectFileSuffix).csproj"
Targets="Build"
- Properties="$(StyleCopProperties);%(TargetFramework.Properties);BaseOutputDirectory=$(BaseOutputDirectory)"
+ Properties="$(StyleCopProperties);%(TargetFramework.Properties);BaseOutputDirectory=$(BaseOutputDirectory);BuildInfoFile=$(BuildInfoFile)"
ToolsVersion="%(TargetFramework.ToolsVersion)"
ContinueOnError="$(BuildAllFrameworks)"
StopOnFirstFailure="false" />
<MSBuild Projects="NLog.Extended\NLog.Extended%(TargetFramework.ProjectFileSuffix).csproj"
Targets="Build"
- Properties="$(StyleCopProperties);%(TargetFramework.Properties);BaseOutputDirectory=$(BaseOutputDirectory)"
+ Properties="$(StyleCopProperties);%(TargetFramework.Properties);BaseOutputDirectory=$(BaseOutputDirectory);BuildInfoFile=$(BuildInfoFile)"
ToolsVersion="%(TargetFramework.ToolsVersion)"
ContinueOnError="$(BuildAllFrameworks)"
StopOnFirstFailure="false"
Condition="Exists('NLog.Extended\NLog.Extended%(TargetFramework.ProjectFileSuffix).csproj')" />
- <MSBuild Projects="..\tools\InstallNLogConfig\InstallNLogConfig%(TargetFramework.ProjectFileSuffix).csproj"
+ <MSBuild Projects="InstallNLogConfig\InstallNLogConfig%(TargetFramework.ProjectFileSuffix).csproj"
Targets="Build"
- Properties="$(StyleCopProperties);%(TargetFramework.Properties);BaseOutputDirectory=$(BaseOutputDirectory)"
+ Properties="$(StyleCopProperties);%(TargetFramework.Properties);BaseOutputDirectory=$(BaseOutputDirectory);BuildInfoFile=$(BuildInfoFile)"
ToolsVersion="%(TargetFramework.ToolsVersion)"
ContinueOnError="$(BuildAllFrameworks)"
StopOnFirstFailure="false"
@@ -369,4 +369,9 @@
<CodeAnalysisDictionary Include="CustomDictionary.xml" />
</ItemGroup>
<Import Project="..\Mono.targets" />
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -382,4 +382,9 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -384,4 +384,9 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -366,4 +366,9 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(StyleCopTargetsFile)" Condition="'$(StyleCopTargetsFile)' != ''" />
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -368,4 +368,9 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(StyleCopTargetsFile)" Condition="'$(StyleCopTargetsFile)' != ''" />
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -372,4 +372,9 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(StyleCopTargetsFile)" Condition="Exists('$(StyleCopTargetsFile)')" />
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
View
@@ -374,4 +374,9 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
View
@@ -374,4 +374,9 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
View
@@ -375,4 +375,9 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
View
@@ -376,4 +376,9 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
@@ -369,11 +369,16 @@
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
<ProjectExtensions />
+ <Target Name="BeforeBuild">
+ <ItemGroup Condition="Exists('$(BuildInfoFile)')">
+ <Compile Include="$(BuildInfoFile)" />
+ </ItemGroup>
+ </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project>

0 comments on commit 74993b6

Please sign in to comment.