90
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 <?xml version="1.0" encoding="utf-8"?>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 <PropertyGroup>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 <!-- Windows specific commands -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 <NuGetToolsPath Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 <PackagesConfig Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 <PackagesDir Condition=" '$(OS)' == 'Windows_NT'">$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 <!-- We need to launch nuget.exe with the mono command if we're not on windows -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 <NuGetToolsPath Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir).nuget</NuGetToolsPath>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 <PackagesConfig Condition=" '$(OS)' != 'Windows_NT' ">packages.config</PackagesConfig>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 <PackagesDir Condition=" '$(OS)' != 'Windows_NT'">$(SolutionDir)packages</PackagesDir>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 <!-- NuGet command -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 <NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 <NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 <PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 <PackageSources>""</PackageSources>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 <!-- Enable the restore command to run before builds -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 <RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 <!-- Property that enables building a package from a project -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 <BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
32 <!-- Commands -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
33 <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
34 <BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
35
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
36 <!-- Make the build depend on restore packages -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
37 <BuildDependsOn Condition="$(RestorePackages) == 'true'">
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
38 RestorePackages;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
39 $(BuildDependsOn);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
40 </BuildDependsOn>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
41
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
42 <!-- Make the build depend on restore packages -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
43 <BuildDependsOn Condition="$(BuildPackage) == 'true'">
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
44 $(BuildDependsOn);
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
45 BuildPackage;
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
46 </BuildDependsOn>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
47 </PropertyGroup>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
48
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
49 <Target Name="CheckPrerequisites">
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
50 <!-- Raise an error if we're unable to locate nuget.exe -->
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
51 <Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
52 </Target>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
53
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
54 <Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
55 <Exec Command="$(RestoreCommand)"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
56 Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
57
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
58 <Exec Command="$(RestoreCommand)"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
59 LogStandardErrorAsError="true"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
60 Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
61 </Target>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
62
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
63 <Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
64 <Exec Command="$(BuildCommand)"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
65 Condition=" '$(OS)' != 'Windows_NT' " />
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
66
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
67 <Exec Command="$(BuildCommand)"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
68 LogStandardErrorAsError="true"
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
69 Condition=" '$(OS)' == 'Windows_NT' " />
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
70 </Target>
|
stevenhollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
71 </Project> |