Setting Up A SymBol Server For .NET WITH Bitbucket AND GitLink

Since two years we develop own nuget-packages in our company. It was a problem to debug these packages when we ran into errors with them. So we needed to setup a symbol-server…

If you don’t know what the purpose of a symbol server is, you read about it here:

A guy who set up a symbol server also with bitbucket, posted it experience here:

So, actually, I did nearly the same, but I want to share my own experience with it.

We also use bamboo and build tasks. So we wanted to automate the modifying of the pdb and pushing the pdb to the symbol server. Our script is looking like this:

$workingDir = $Env:bamboo_working_directory 
$shortPlanName = $Env:bamboo_shortPlanName

$pdbFile = $shortPlanName + ".pdb"
$bitbucketProjectKey = "MYNUGETPROJECTS"

$pathToPdb = $workingDir + "\Source\bin\Release\" + $pdbFile

$url = "http://etimgm01.etiscan.local:81/" + $bitbucketProjectKey + "/repos/" + $shortPlanName + "/raw/{filename}/rev/{revision}"
$arguments = $pathToPdb + " --baseDir " + $workingDir + " --url " + $url

Write-Host $pathToPdb
Write-Host $url
Write-Host $arguments

$process = Start-Process -FilePath C:\tools\gitlink\gitlink.exe -ArgumentList $arguments -Wait
Write-Host "Exit-Code GitLink: " + $process.ExitCode

$arguments = "add /r /s \\etisrv01\sources\000_SymbolServer /f " + $pathToPdb + " /t " + $shortPlanName

$process = Start-Process -FilePath "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\symstore.exe" -ArgumentList $arguments -Wait
Write-Host "Exit-Code symstore: " + $process.ExitCode

As you see, there is a link to a local webserver and not directly to bitbucket. The problem is also mentioned by Shonn Lyga. So we had to set up a URL-Rewrite in an IIS-Server, because “srcsrv.dll” doesn’t support question marks in its URL. The following screenshot shows the incoming rule for the IIS-Server which redirects to the bitbucket-server:

In the powershell script you also find the tool “GitLink“. This tool modifies the pdb and maps the files with the corresponding URL. So you tell the pdb where to find the corresponding source file. Additional informations for GitLink you will find on GitHub.

So I hope that someone is out there who can use this information.