1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <Project DefaultTargets =" Default"
3+ xmlns =' http://schemas.microsoft.com/developer/msbuild/2003' ToolsVersion =" 4.0" >
4+ <Import Project =" $(MSBuildProjectDirectory)/build.tasks" />
5+
6+ <PropertyGroup >
7+ <MajorVersion Condition =" $(MajorVersion) == ''" >5</MajorVersion >
8+ <MinorVersion Condition =" $(MinorVersion) == ''" >0</MinorVersion >
9+ <PatchVersion Condition =" $(PatchVersion) == ''" >$(BUILD_NUMBER)</PatchVersion >
10+ </PropertyGroup >
11+
12+ <PropertyGroup >
13+ <BuildSolutionDir >$(MSBuildProjectDirectory)/..</BuildSolutionDir >
14+ <SrcDir >$(BuildSolutionDir)/src</SrcDir >
15+ <Configuration Condition =" $(Configuration) == ''" >Release</Configuration >
16+ <NuGetPackageDir >$(BuildSolutionDir)/NuGet/</NuGetPackageDir >
17+ <PackageVersion >$(MajorVersion).$(MinorVersion).$(PatchVersion)</PackageVersion >
18+ </PropertyGroup >
19+
20+ <PropertyGroup >
21+ <DoBuildSolutionsDependsOn >
22+ BeforeBuildSolutions;
23+ BuildSolutions
24+ </DoBuildSolutionsDependsOn >
25+ </PropertyGroup >
26+
27+ <Target Name =" BeforeBuildSolutions" >
28+ <Message Text =" *****Before building solution*****" Importance =" high" />
29+ <CallTarget Targets =" UpdateVersion" />
30+ </Target >
31+
32+ <Target Name =" BuildSolutions" >
33+ <ItemGroup >
34+ <NugetPackageFilesToDelete Include =" $(NuGetPackageDir)/*.nupkg" />
35+ </ItemGroup >
36+ <Delete Files =" @(NugetPackageFilesToDelete)" />
37+ <CallTarget Targets =" ClearNuGetRestoreCaches" />
38+ </Target >
39+
40+ <!-- need to remove old caches from nuget restore from .Core csproj's -->
41+ <Target Name =" ClearNuGetRestoreCaches" >
42+ <RemoveDir Directories =" $(SrcDir)/ServiceStack.Redis/obj" />
43+ </Target >
44+
45+ <Target Name =" UpdateVersion" >
46+ <!-- Update Version -->
47+ <ItemGroup >
48+ <RegexTransform Include =" $(BuildSolutionDir)/src/Directory.Build.props;$(BuildSolutionDir)/tests/Directory.Build.props" >
49+ <Find >< Version> [^< ]*</Find >
50+ <ReplaceWith >< Version> $(PackageVersion)</ReplaceWith >
51+ </RegexTransform >
52+ </ItemGroup >
53+
54+ <RegexTransform Items =" @(RegexTransform)" />
55+ </Target >
56+
57+ <Target Name =" Default" DependsOnTargets =" $(DoBuildSolutionsDependsOn)" >
58+
59+ <!-- ServiceStack.Redis.Core -->
60+ <MSBuild Projects =" $(BuildSolutionDir)/src/ServiceStack.Redis/ServiceStack.Redis.Core.csproj" Targets =" Restore" />
61+ <MSBuild Projects =" $(BuildSolutionDir)/src/ServiceStack.Redis/ServiceStack.Redis.Core.csproj"
62+ Targets =" Build;Pack"
63+ Properties =" Configuration=$(Configuration)" />
64+
65+
66+ <!-- Copy all *.nupkg to /NuGet -->
67+ <ItemGroup >
68+ <NugetPackagesToMove Include =" $(BuildSolutionDir)/src/**/bin/$(Configuration)/*.nupkg" />
69+ </ItemGroup >
70+ <Move SourceFiles =" @(NugetPackagesToMove)" DestinationFolder =" $(NuGetPackageDir)" />
71+
72+ <!-- leave .sln in optimal state then NuGet restore .sln to build -->
73+ <CallTarget Targets =" ClearNuGetRestoreCaches" />
74+
75+ </Target >
76+ </Project >
0 commit comments