SourceLink Authentication error when using Microsoft.SourceLink.AzureRepos.Git
- Dominant language
- C#
- Stars
- 1.4k
- Forks
- 148
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to enable SourceLink for our internal NuGet packages and am running into a problem where I don't see how I can solve it.
My setup is:
- Visual Studio 2019 Enterprise (16.3.8)
- An Azure DevOps git repository
- A .NET Framework 4.7.2 class library with an SDK style project containing a single HelloWorld class
- A PackageReference to Microsoft.SourceLink.AzureRepos.Git, using the latest Version (1.0.0-beta2-19554-01)
This project generates a package that includes the DLL and the PDB (I know this is discouraged, but I would like to get it to work this way rather than using a symbol server; this also does not seem to be the source of the problem, since the debugger finds the correct PDB)
The project file
```
net472
true
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
https://.visualstudio.com//_git/Lib
git
2.0.0.0
2.0.0.0
2.0.0
all
runtime; build; native; contentfiles; analyzers; buildtransitive
```
- I commit my changes to the repository and build the package. The package builds fine. When I check the generated .nuspec file, it contains the correct commit hash.
- I publish it to a local NuGet feed using nuget add Lib.2.0.0.nupkg -Source C:\NuGet.
- I delete my local HelloWorld sources so the debugger does not find these sources and tries to download them from the git repository
- I create a console application, reference this NuGet package, and call the HelloWorld function on the HelloWorld class. In the debugger, I hit F11 to step into the HelloWorld call. The "SourceLink will download [...]" dialog box appears and I select "Download Source and Continue Debugging".
This does not work. I get the following error message
```
Source Link Error:
ERROR: Azure DevOps: Authentication failed for all accounts. Use 'File -> Account Settings...' to add a new account or refresh credentials.
Source Link URL: https://.visualstudio.com//_apis/git/repositories/Lib/items?api-version=1.0&versionType=commit&version=cf94d5a0f224b6983c3885a2a6ac29aa52cec418&path=/HelloWorld/HelloWorld.cs
```
Now, the error message is pretty clear, I just don't get it. When I go to the URL stated in the error message, I see the file content I am expecting. I used a browser I never use to check, and when navigating to this page, it asked me to sign in, and I do so using the same account I use in Visual Studio. I also tried signing out of Visual Studio, restarting it, and signing in again to Visual Studio using the same account I used in the browser. Still the same error.
Any idea what I could be doing wrong?
Thanks,
David
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.