-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.proj
109 lines (85 loc) · 4.6 KB
/
build.proj
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
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="BuildProperties.resx" />
<Target Name="Test">
<Message Text="Property Data:" />
<Message Text=" - AssemblyCompany: '$(AssemblyCompany)'" />
<Message Text=" - AssemblyCopyright: '$(AssemblyCopyright)'" />
<Message Text=" - LibraryPath: '$(LibraryPath)'" />
<Message Text=" - OutputFolder: '$(OutputFolder)'" />
</Target>
<Target Name="Help">
<Message Text="ToolsHub MSBuild Commands" />
<Message Text="- - - - - - - - - - - - - - - -" />
<Message Text="MSBuild /t:CompileCode - Builds project from scratch" />
<Message Text="MSBuild /t:CleanOutput - Deletes previous builds" />
<Message Text="MSBuild /t:MakeInstaller - Creates install package" />
<Message Text="- - - - - - - - - - - - - - - -" />
</Target>
<Target Name="Clean">
<Message Text="Clean: Removing directory '$(OutputFolder)'" />
<RemoveDir Directories="$(OutputFolder)"/>
</Target>
<Target Name="Compile" DependsOnTargets="Clean">
<MSBuild Projects="@(ProjectFiles)" />
</Target>
<Target Name="CompileCode" DependsOnTargets="CleanOutput;CompileDevCode">
<Message Text="*** CompileCode complete ***" />
</Target>
<Target Name="CompileDevCode">
<Message Text="CompileDevCode: SourcePath = '$(SourcePath)'" />
<Message Text="CompileDevCode: SolutionName = '$(SolutionName)'" />
<Message Text="CompileDevCode: Projects = '$(SourcePath)\$(SolutionName)'" />
<MSBuild Projects="$(SourcePath)\$(SolutionName)"
Targets="Clean;Build"
Properties="SolutionDir=$(SourcePath)\;Configuration=$(Configuration);OutDir=$(OutputFolder)\"
Condition="Exists('$(SourcePath)\$(SolutionName)')" />
</Target>
<Target Name="CleanOutput">
<Message Text="Cleaning output folder '$(OutputFolder)'" />
<ItemGroup>
<FilesToDelete Include="$(OutputFolder)\**\*" />
</ItemGroup>
<!-- <Message Text="(DEBUG) CleanOutput: Delete Files = '@(FilesToDelete)'" />
<Message Text="(DEBUG) CleanOutput: Remove Dir = '$(OutputFolder)'" />
<Message Text="(DEBUG) CleanOutput: Create Dir = '$(OutputFolder)'" /> -->
<Delete Files="@(FilesToDelete)" />
<RemoveDir Directories="$(OutputFolder)" />
<MakeDir Directories="$(OutputFolder)"/>
<Message Text="Cleanup completed." />
</Target>
<!-- Installer -->
<Target Name="MakeInstaller" DependsOnTargets="CompileCode" Condition="'$(Configuration)' == 'Release'">
<Message Text="Creating installer..." />
<GetAssemblyIdentity AssemblyFiles="$(MainExe)">
<Output TaskParameter="Assemblies" ItemName="AppAssembly"/>
</GetAssemblyIdentity>
<ItemGroup>
<!-- Using item group because it works with multiple-versions. Though it gets the lowest version -->
<NuGetExe Include="source\packages\NuGet.CommandLine.*\tools\nuget.exe" />
<SquirrelExe Include="source\packages\Squirrel.Windows.*\tools\squirrel.exe" />
</ItemGroup>
<PropertyGroup>
<SemanticVersion>$([System.Version]::Parse(%(AppAssembly.Version)).ToString(3))</SemanticVersion>
<NuSpecPath>$(OutputFolder)\$(ProjectName).$(SemanticVersion).nupkg</NuSpecPath>
<NuGetCmd>"%(NuGetExe.FullPath)" pack "$(SquirrelNuSpec)" -Version $(SemanticVersion) -Properties "Configuration=Release" -OutputDirectory "$(OutputFolder)" -BasePath "$(OutputFolder)"</NuGetCmd>
<SquirrelCmd>"%(SquirrelExe.FullPath)" --releasify "$(OutputFolder)\$(ProjectName).$(SemanticVersion).nupkg" --releaseDir="$(SquirrelReleasePath)"</SquirrelCmd>
</PropertyGroup>
<Message Text="Assembly File (MainExe): '$(MainExe)'" />
<Message Text="Assemblies: '%(AppAssembly.Version)'" />
<Message Text="Semantic Version: '$(SemanticVersion)'" />
<Message Text="Output: '$(NuSpecPath)'" />
<Message Text="--------------" />
<!--
<Message Text="$(NuGetCmd)" />
<Message Text="$(SquirrelCmd)" />
-->
<Error Condition="!Exists(%(NuGetExe.FullPath))" Text="You are trying to use the NuGet.CommandLine package, but it is not installed. Please install NuGet.CommandLine from the Package Manager." />
<Error Condition="!Exists(%(SquirrelExe.FullPath))" Text="You are trying to use the Squirrel.Windows package, but it is not installed. Please install Squirrel.Windows from the Package Manager." />
<Message Text="Creating Installer Package..." />
<Exec Command="$(NuGetCmd)" />
<Message Text="Registering with Auto-Updater..." />
<Exec Command="$(SquirrelCmd)" />
<Message Text="Done!" />
</Target>
</Project>