forked from pglazkov/MvvmValidation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.msbuild
150 lines (119 loc) · 5.5 KB
/
build.msbuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BuildFull">
<Import Project="Tools\Build\MSBuild.Community.Tasks.Targets"/>
<UsingTask AssemblyFile=".\packages\xunit.2.0.0-alpha-build1611\lib\net45\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit"/>
<PropertyGroup>
<Major>2</Major>
<Minor>1</Minor>
<Patch>0</Patch>
<PreReleaseString>beta</PreReleaseString>
<VersionInfoString Condition="$(PreReleaseString) != ''">$(Major).$(Minor).$(Patch)-$(PreReleaseString)</VersionInfoString>
<VersionInfoString Condition="$(PreReleaseString) == ''">$(Major).$(Minor).$(Patch)</VersionInfoString>
</PropertyGroup>
<PropertyGroup>
<Configuration>Release</Configuration>
<SourceDir>.\</SourceDir>
<SolutionFilePath>$(SourceDir)MvvmValidation.sln</SolutionFilePath>
<OutputFolderPath>$(SourceDir)Output</OutputFolderPath>
<VersionInfoPath>$(SourceDir)VersionInfo.cs</VersionInfoPath>
<PortableAssemblyOutputFolder>$(OutputFolderPath)\lib\portable-win8+net45+sl5+wp8</PortableAssemblyOutputFolder>
<Net45NuGetOutputFolder>$(OutputFolderPath)\lib\net45</Net45NuGetOutputFolder>
<MainAssemblyWithVersion>$(PortableAssemblyOutputFolder)\MvvmValidation.dll</MainAssemblyWithVersion>
<NuGetPreRelaseVersionSuffix>-beta</NuGetPreRelaseVersionSuffix>
<UnitTestAssembliesPath>$(SourceDir)\**\bin\$(Configuration)\*.Tests.dll</UnitTestAssembliesPath>
<UnitTestHtmlReportPath>$(SourceDir)TestReport.html</UnitTestHtmlReportPath>
<ZippedOutputFileName>MvvmValidation.$(VersionInfoString).zip</ZippedOutputFileName>
<ZippedOutputFilePath>$(OutputFolderPath)\$(ZippedOutputFileName)</ZippedOutputFilePath>
</PropertyGroup>
<ItemGroup>
<UnitTestAssemblies Include="$(UnitTestAssembliesPath)" />
<OutputFolder Include="$(OutputFolderPath)"/>
</ItemGroup>
<PropertyGroup>
<BuildFullDependsOn>
Clean;
BuildSolution;
CleanupAfterBuild;
CopyOutputToAdditionalNuGetFolders;
UnitTest;
ZipOutput;
CreateNuGetPackage
</BuildFullDependsOn>
<BuildSolutionDependsOn>
UpdateVersion
</BuildSolutionDependsOn>
<UpdateVersionDependsOn>
</UpdateVersionDependsOn>
<CreateNuGetPackageDependsOn>
BuildSolution
</CreateNuGetPackageDependsOn>
<CleanupAfterBuildDependsOn>
BuildSolution
</CleanupAfterBuildDependsOn>
<UnitTestDependsOn>
BuildSolution
</UnitTestDependsOn>
<ZipOutputDependsOn>
BuildSolution
</ZipOutputDependsOn>
</PropertyGroup>
<Target Name="BuildFull" DependsOnTargets="$(BuildFullDependsOn)">
</Target>
<Target Name="Clean">
<MSBuild Projects="$(SolutionFilePath)" ContinueOnError="false" Properties="Configuration=$(Configuration)" Targets="Clean" />
<CreateItem Include="%(OutputFolder.FullPath)\**\*.*">
<Output TaskParameter="Include" ItemName="FilesToRemove"/>
</CreateItem>
<Delete Files="%(FilesToRemove.FullPath)" ContinueOnError="true" />
<RemoveDir Directories="%(OutputFolder.FullPath)" ContinueOnError="true"/>
<MakeDir Directories="%(OutputFolder.FullPath)" ContinueOnError="true"/>
</Target>
<Target Name="BuildSolution" DependsOnTargets="$(BuildSolutionDependsOn)">
<MSBuild Projects="$(SolutionFilePath)" ContinueOnError="false" Properties="Configuration=$(Configuration);BuildInParallel=True">
<Output ItemName="BuildOutput" TaskParameter="TargetOutputs"/>
</MSBuild>
</Target>
<Target Name="CopyOutputToAdditionalNuGetFolders">
<ItemGroup>
<Net45Files Include="$(PortableAssemblyOutputFolder)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(Net45Files)" DestinationFolder="$(Net45NuGetOutputFolder)"/>
</Target>
<Target Name="CleanupAfterBuild" DependsOnTargets="$(CleanupAfterBuildDependsOn)">
<!-- Delete code analysis files -->
<CreateItem Include="$(OutputFolderPath)\**\*CodeAnalysisLog.xml">
<Output TaskParameter="Include" ItemName="CodeAnalysisFiles" />
</CreateItem>
<CreateItem Include="$(OutputFolderPath)\**\*.lastcodeanalysissucceeded">
<Output TaskParameter="Include" ItemName="CodeAnalysisFiles" />
</CreateItem>
<Delete Files="%(CodeAnalysisFiles.FullPath)" ContinueOnError="false" />
</Target>
<Target Name="UnitTest" DependsOnTargets="$(UnitTestDependsOn)">
<xunit Assemblies="@(UnitTestAssemblies)" Html="$(UnitTestHtmlReportPath)" />
</Target>
<Target Name="UpdateVersion"
DependsOnTargets="$(UpdateVersionDependsOn)">
<Message Text="Version: $(VersionInfoString)"/>
<AssemblyInfo CodeLanguage="CS"
OutputFile="$(VersionInfoPath)"
AssemblyVersion="$(Major).$(Minor).$(Patch)"
AssemblyFileVersion="$(Major).$(Minor).$(Patch)"
AssemblyInformationalVersion="$(VersionInfoString)"/>
<XmlUpdate XmlFileName="Package.nuspec"
XPath="package/metadata/version"
Value="$(VersionInfoString)"/>
</Target>
<Target Name="CreateNuGetPackage"
DependsOnTargets="$(CreateNuGetPackageDependsOn)">
<Exec Command="Tools\NuGet.exe pack Package.nuspec -BasePath $(OutputFolderPath) -OutputDirectory $(OutputFolderPath) -Exclude **\Tests\** -Exclude **\*.pdb -Exclude **\$(ZippedOutputFileName)"/>
</Target>
<Target Name="ZipOutput"
DependsOnTargets="$(ZipOutputDependsOn)">
<ItemGroup>
<ZipOutputFiles Include="$(OutputFolderPath)\lib\**\*.*" />
</ItemGroup>
<Zip Files="@(ZipOutputFiles)"
WorkingDirectory="$(OutputFolderPath)"
ZipFileName="$(ZippedOutputFilePath)" />
</Target>
</Project>