C# 使用Microsoft.SourceLink.AzureRepos.Git时发生SourceLink身份验证错误

C# 使用Microsoft.SourceLink.AzureRepos.Git时发生SourceLink身份验证错误,c#,git,visual-studio,azure-devops,sourcelink,C#,Git,Visual Studio,Azure Devops,Sourcelink,我正在尝试为我们的内部NuGet软件包启用SourceLink,但遇到了一个我不知道如何解决的问题 我的设置是: Visual Studio 2019企业版(16.3.8) Azure DevOps git存储库 一个.NET Framework 4.7.2类库,带有包含单个HelloWorld类的SDK样式项目 使用最新版本(1.0.0-beta2-19554-01)的对Microsoft.SourceLink.AzureRepos.Git的包引用 此项目生成一个包含DLL和PDB的包(我知

我正在尝试为我们的内部NuGet软件包启用SourceLink,但遇到了一个我不知道如何解决的问题

我的设置是:

  • Visual Studio 2019企业版(16.3.8)
  • Azure DevOps git存储库
  • 一个.NET Framework 4.7.2类库,带有包含单个HelloWorld类的SDK样式项目
  • 使用最新版本(1.0.0-beta2-19554-01)的对Microsoft.SourceLink.AzureRepos.Git的包引用
  • 此项目生成一个包含DLL和PDB的包(我知道不鼓励这样做,但我希望它以这种方式工作,而不是使用符号服务器;这似乎也不是问题的根源,因为调试器找到了正确的PDB)
项目文件

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
    <RepositoryUrl>https://<host>.visualstudio.com/<project>/_git/Lib</RepositoryUrl>
    <RepositoryType>git</RepositoryType>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
    <FileVersion>2.0.0.0</FileVersion>
    <Version>2.0.0</Version>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0-beta2-19554-01">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>
</Project>
现在,错误信息很清楚,我就是不明白。当我转到错误消息中所述的URL时,我会看到预期的文件内容。我使用了一个从未使用过的浏览器进行检查,当导航到此页面时,它要求我登录,我使用的帐户与在Visual Studio中使用的帐户相同。我还尝试注销Visual Studio,重新启动它,然后使用我在浏览器中使用的相同帐户再次登录到Visual Studio。还是一样的错误


我有点迷路了。有人知道我还能尝试什么吗?

我认为这是一个bug。默认情况下,即使我们勾选了“所有sourcelink请求都返回git凭据管理器”。但它仍然使用当前VS帐户来验证git存储库凭据。在我使用Azure DevOps之后。它工作得很好,我使用Azure DevOps中的帐户登录VS。如果您发现此问题一直失败,请在Azure DevOps的开发者社区中创建一个问题:我认为这是一个bug。默认情况下,即使我们勾选了“所有sourcelink请求都返回git凭据管理器”。但它仍然使用当前VS帐户来验证git存储库凭据。在我使用Azure DevOps之后。它工作得很好,我使用Azure DevOps中的帐户登录VS。如果您发现此操作一直失败,请在Azure DevOps的开发者社区中创建一个问题:
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://<host>.visualstudio.com/<project>/_apis/git/repositories/Lib/items?api-version=1.0&versionType=commit&version=cf94d5a0f224b6983c3885a2a6ac29aa52cec418&path=/HelloWorld/HelloWorld.cs