'SourceRoot.SourceLinkUrl is empty' error running on Azure Pipelines (VSTS) agent configured with new URL
See original GitHub issueI have an Azure DevOps (aka VSTS) organisation that existed prior to the recent naming change.
I recently configured a new build agent following the instructions here https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=vsts#download-and-configure-the-agent - specifically I used the server url format https://dev.azure.com/{your-organization}
When trying to build our solution that references the Microsoft.SourceLink.Vsts.Git package, it failed with the following error:
C:\Windows\ServiceProfiles\NetworkService\.nuget\packages\microsoft.sourcelink.common\1.0.0-beta-63127-02\build\Microsoft.SourceLink.Common.targets(40,5): error : SourceRoot.SourceLinkUrl is empty
Cracking open the msbuild.binlog shows the following data for the Microsoft.SourceLink.Vsts.Git.GetSourceLinkUrl task:
Microsoft.SourceLink.Vsts.Git.GetSourceLinkUrl
Assembly = C:\Windows\ServiceProfiles\NetworkService\.nuget\packages\microsoft.sourcelink.vsts.git\1.0.0-beta-63127-02\build\..\tools\net461\Microsoft.SourceLink.Vsts.Git.dll
Parameters
RepositoryUrl = https://organisation.visualstudio.com/MyProject/_git/MyProject
SourceRoot
C:\agent\_work\2\s\
MappedPath=C:\agent\_work\2\s\
RepositoryUrl=https://dev.azure.com/organisation/MyProject/_git/MyProject
RevisionId=2a6a036a6ebef2a7966404a53ec02168a3859465
ScmRepositoryUrl=https://dev.azure.com/organisation/MyProject/_git/MyProject
SourceControl=git
Hosts
visualstudio.com
vsts.me
IsSingleProvider = True
OutputProperties
_SourceLinkUrlToUpdate = N/A
It struck me as suspicious that the RepositoryUrl parameters are different.
I ended up reinstalling the build agent and this time configured it with a server URL using the old format (https://organisation.visualstudio.com) and this error no longer happened.
That’s probably not a long term solution given that the plan is to move everyone over to the new naming standard, so I think Microsoft.SourceLink.Vsts.Git might need to account for this ‘mixed’ mode of repository names.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (9 by maintainers)
Top GitHub Comments
I believe the solution is to add
<SourceLinkVstsGitHost Include="dev.azure.com" />
to here: https://github.com/dotnet/sourcelink/blob/master/src/SourceLink.Vsts.Git/build/Microsoft.SourceLink.Vsts.Git.props#L7In the interim, adding
to the project file should work
Closing as duplicate of #279