88
99Param (
1010 [Parameter (Mandatory = $true )]
11- [string ]$commitSha
11+ [string ]$commitSha ,
12+ [scriptblock ]$postBuild
1213)
1314
1415$ErrorActionPreference = " Stop"
@@ -51,10 +52,19 @@ function Clean-OutputFolder($folder) {
5152 }
5253}
5354
55+ # From http://www.dougfinke.com/blog/index.php/2010/12/01/note-to-self-how-to-programmatically-get-the-msbuild-path-in-powershell/
56+
57+ Function Get-MSBuild {
58+ $lib = [System.Runtime.InteropServices.RuntimeEnvironment ]
59+ $rtd = $lib ::GetRuntimeDirectory()
60+ Join-Path $rtd msbuild.exe
61+ }
62+
5463# ################
5564
5665$root = Split-Path - Parent - Path $MyInvocation.MyCommand.Definition
5766$projectPath = Join-Path $root " ..\LibGit2Sharp"
67+ $slnPath = Join-Path $projectPath " ..\LibGit2Sharp.sln"
5868
5969Remove-Item (Join-Path $projectPath " *.nupkg" )
6070
@@ -68,11 +78,15 @@ Push-Location $projectPath
6878
6979try {
7080 Set-Content - Encoding ASCII $ (Join-Path $projectPath " libgit2sharp_hash.txt" ) $commitSha
71- Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Restore " $ ( Join-Path $projectPath " ..\LibGit2Sharp.sln" ) " }
81+ Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Restore " $slnPath " }
82+ Run- Command { & (Get-MSBuild ) " $slnPath " " /verbosity:minimal" " /p:Configuration=Release" }
83+
84+ If ($postBuild ) {
85+ Write-Host - ForegroundColor " Green" " Run post build script..."
86+ Run- Command { & ($postBuild ) }
87+ }
7288
73- # Cf. https://stackoverflow.com/questions/21728450/nuget-exclude-files-from-symbols-package-in-nuspec
74- Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Pack - Build - Symbols " $ ( Join-Path $projectPath " LibGit2Sharp.csproj" ) " - Prop Configuration= Release - Exclude " **/NativeBinaries/**/*.*" }
75- Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Pack " $ ( Join-Path $projectPath " LibGit2Sharp.csproj" ) " - Prop Configuration= Release }
89+ Run- Command { & " $ ( Join-Path $projectPath " ..\Lib\NuGet\Nuget.exe" ) " Pack - Prop Configuration= Release }
7690}
7791finally {
7892 Pop-Location
0 commit comments