forked from Humanizr/Humanizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.proj
92 lines (79 loc) · 4.04 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
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build;Test" ToolsVersion="14.0">
<!--Project configuration-->
<PropertyGroup>
<XUnitPath>$(MSBuildThisFileDirectory)packages\xunit.runner.msbuild\build\portable-net45+win8+wp8+wpa81</XUnitPath>
<CodeTaskAssembly Condition="'$(MSBuildAssemblyVersion)' == ''">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll</CodeTaskAssembly>
<!-- In VS2013, the assembly contains the VS version. -->
<CodeTaskAssembly Condition="'$(MSBuildAssemblyVersion)' == '12.0'">$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll</CodeTaskAssembly>
<!-- In VS2015+, the assembly was renamed -->
<CodeTaskAssembly Condition="'$(MSBuildAssemblyVersion)' != '' and '$(MSBuildAssemblyVersion)' >= '14.0'">$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll</CodeTaskAssembly>
</PropertyGroup>
<ItemGroup>
<ProjectToBuild Include="Src\*.sln" />
</ItemGroup>
<!-- Expand build output files AFTER the build has run.
Note that the Build Task MUST BE defined by the file that includes this file. -->
<Target Name="GetTestAssemblies" DependsOnTargets="Build">
<ItemGroup>
<TestAssemblies Include="**\bin\Release\*.Tests.dll" />
</ItemGroup>
</Target>
<UsingTask TaskName="xunit" AssemblyFile="$(XUnitPath)\xunit.runner.msbuild.dll" />
<!--Clean-->
<Target Name="CleanAll" DependsOnTargets="CleanDebug;CleanRelease" />
<Target Name="CleanDebug">
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean" Properties="Configuration=Debug" />
</Target>
<Target Name="CleanRelease">
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean" Properties="Configuration=Release" />
</Target>
<!--Compile-->
<Target Name="Build" DependsOnTargets="CleanAll;RestorePackages">
<MSBuild Projects="@(ProjectToBuild)" Properties="Configuration=Release" />
</Target>
<!--Test. Note that the GetTestAssemblies Task MUST BE defined in the Build.config file. -->
<Target Name="Test" DependsOnTargets="GetTestAssemblies">
<xunit Assemblies="@(TestAssemblies)" />
</Target>
<!--Nuget restore-->
<ItemGroup>
<Solution Include="$(MSBuildThisFileDirectory)src\*.sln" />
</ItemGroup>
<Target Name="RestorePackages" DependsOnTargets="_DownloadNuGet">
<Exec Command=""$(MSBuildThisFileDirectory)tools\NuGet\NuGet.exe" install xunit.runner.msbuild -SolutionDir "$(MSBuildProjectDirectory)" -Verbosity quiet -ExcludeVersion" Condition="!Exists('$(MSBuildThisFileDirectory)packages\xunit.runner.msbuild\')" />
<Exec Command=""$(MSBuildThisFileDirectory)tools\NuGet\NuGet.exe" restore "%(Solution.Identity)"" />
</Target>
<Target Name="_DownloadNuGet">
<MakeDir Directories="$(MSBuildThisFileDirectory)tools\NuGet" />
<DownloadNuGet OutputFilename="$(MSBuildThisFileDirectory)tools\NuGet\nuget.exe" Condition="!Exists('$(MSBuildThisFileDirectory)tools\NuGet\nuget.exe')" />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(CodeTaskAssembly)">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://dist.nuget.org/win-x86-commandline/latest/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>