Search code examples
azure-devopssymbol-serversourcelink

Source link can't download source files for nuget from private azure symbol server, uses wrong domain dev.azure.com/raw/


TL;DR

Azure devops is used, VS with source link tries to open source form https://dev.azure.com/raw/... with 404 error, looks like domain generation pattern is wrong

We have nuget package and want to enable debugging of its source code. Everything is done via azure devops, task "https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/build/index-sources-publish-symbols?view=azure-devops" are setup while building nuget.

In visual studio, "use source link" enabled and "just my code" disabled. Source server in VS set to dev.azure.com with private credentials.

While debug symbols are found and loaded, alert about "source link will download source from internet" apppears but then 404 error is mentioned in logs

It tries to download https://dev.azure.com/raw/SomeName/SomeProject/_git/XXX.Library/8ab2f2673396a762aeb7d70fbdca85357ec731d0/XXX.Library/Utils/ApiProxy.cs In browser I can't access this file with 404 status too.

But via Azure UI I can find this file e.g. via https://dev.azure.com/SomeName/SomeProject/_git/XXX.Library/commit/e982b34fa3ff2524eb0f479197369555e64534f2?refName=refs%2Fheads%2Fmaster&_a=contents&path=%2FXXX%2FUtils%2FApiProxy.cs

So it looks like that source link generate path using github.com pattern instead of azure-related pattern.


Solution

  • Finally found the problem, nuget package has reference to <PackageReference Include="Microsoft.SourceLink.GitHub" ../>, for source on azure devops it should be <PackageReference Include="Microsoft.SourceLink.Vsts.Git" ../>