question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'SourceRoot.SourceLinkUrl is empty' error running on Azure Pipelines (VSTS) agent configured with new URL

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
clairernovotnycommented, Oct 13, 2018

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#L7

In the interim, adding

  <ItemGroup>
    <SourceLinkVstsGitHost Include="dev.azure.com" />
  </ItemGroup>

to the project file should work

0reactions
tmatcommented, Nov 4, 2019

Closing as duplicate of #279

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Pipelines Agents
Learn about building your code or deploying your software using agents in Azure Pipelines and Team Foundation Server.
Read more >
Azure pipeline error: Directory '/home/vsts/work/1/a' is ...
i' ve set pathToPublish: '$(Build.ArtifactStagingDirectory)' but it shows again: ##[warning]Directory '/home/vsts/work/1/a' is empty. Nothing ...
Read more >
Setup azure-pipelines.yml "Directory '/home/vsts/work/1/a' ...
Logically, your error message tells us that $(Build.ArtifactStagingDirectory) is empty when the pipeline reaches the last step.
Read more >
Azure Pipelines: Value cannot be null. Parameter name: key
After adding the below piece of code in azure-pipelines.yml I'm getting this error - "Value cannot be null. Parameter name: key". resources:.
Read more >
Microsoft-hosted agents for Azure Pipelines
If your pipelines are in Azure Pipelines, then you've got a convenient option to run your jobs using a Microsoft-hosted agent.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found