1+ <?xml version =" 1.0" encoding =" utf-8" ?>
2+ <Project ToolsVersion =" 4.0" xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
3+ <PropertyGroup >
4+ <SolutionDir Condition =" $(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'" >$(MSBuildProjectDirectory)\..\</SolutionDir >
5+ <NuGetToolsPath >$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath >
6+ <NuGetExePath >$(NuGetToolsPath)\nuget.exe</NuGetExePath >
7+ <PackagesConfig >$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig >
8+ <PackagesDir >$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir >
9+ <PackageOutputDir Condition =" $(PackageOutputDir) == ''" >$(TargetDir.Trim('\\'))</PackageOutputDir >
10+
11+ <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
12+ <PackageSources >""</PackageSources >
13+
14+ <!-- Enable the restore command to run before builds -->
15+ <RestorePackages Condition =" $(RestorePackages) == ''" >false</RestorePackages >
16+
17+ <!-- Property that enables building a package from a project -->
18+ <BuildPackage Condition =" $(BuildPackage) == ''" >false</BuildPackage >
19+
20+ <!-- Commands -->
21+ <RestoreCommand >"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand >
22+ <BuildCommand >"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand >
23+
24+ <!-- Make the build depend on restore packages -->
25+ <BuildDependsOn Condition =" $(RestorePackages) == 'true'" >
26+ RestorePackages;
27+ $(BuildDependsOn);
28+ </BuildDependsOn >
29+
30+ <!-- Make the build depend on restore packages -->
31+ <BuildDependsOn Condition =" $(BuildPackage) == 'true'" >
32+ $(BuildDependsOn);
33+ BuildPackage;
34+ </BuildDependsOn >
35+ </PropertyGroup >
36+
37+ <Target Name =" CheckPrerequisites" >
38+ <!-- Raise an error if we're unable to locate nuget.exe -->
39+ <Error Condition =" !Exists('$(NuGetExePath)')" Text =" Unable to locate '$(NuGetExePath)'" />
40+ </Target >
41+
42+ <Target Name =" RestorePackages" DependsOnTargets =" CheckPrerequisites" >
43+ <Exec Command =" $(RestoreCommand)"
44+ LogStandardErrorAsError =" true"
45+ Condition =" Exists('$(PackagesConfig)')" />
46+ </Target >
47+
48+ <Target Name =" BuildPackage" DependsOnTargets =" CheckPrerequisites" >
49+ <Exec Command =" $(BuildCommand)"
50+ LogStandardErrorAsError =" true" />
51+ </Target >
52+ </Project >
0 commit comments