Visual studio 为什么可以';我不能用sourcelink调试我的nuget包吗?

Visual studio 为什么可以';我不能用sourcelink调试我的nuget包吗?,visual-studio,github,nuget,.net-5,sourcelink,Visual Studio,Github,Nuget,.net 5,Sourcelink,我在csproj中启用了源链接,并使用github操作发布我的nuget,但添加了PublishRepositoryUrl属性并引用了Microsoft.SourceLink.github包 但是,当我引用包时,我不能进入代码,也不能进入定义: <Project Sdk="Microsoft.NET.Sdk.Razor"> <PropertyGroup> <TargetFramework>net5.0</TargetFr

我在csproj中启用了源链接,并使用github操作发布我的nuget,但添加了PublishRepositoryUrl属性并引用了Microsoft.SourceLink.github

但是,当我引用包时,我不能进入代码,也不能进入定义:

<Project Sdk="Microsoft.NET.Sdk.Razor">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
    <PackageProjectUrl>https://github.com/Liero/vNext.BlazorComponents</PackageProjectUrl>
    <PublishRepositoryUrl>true</PublishRepositoryUrl>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
  </ItemGroup>

</Project>
我还禁用了Visual Studio中的代码调试

如果有人想尝试,以下是复制的步骤:

  • 在VisualStudio中创建新的Blazor项目

  • 将包引用添加到vNext.BlazorComponents

  • 修改index.razor:

     @page "/"
     @using vNext.BlazorComponents.Grid
    
     <SimpleGrid TRow="object" @ref="grid"></SimpleGrid>
    
     @code {
         SimpleGrid<object> grid;
    
             protected override void OnAfterRender(bool firstRender)
             {
                 base.OnAfterRender(firstRender);
                 grid.Refresh(); // put breakpoint here and step into
             }
     }
    
    @page/“
    @使用vNext.BlazorComponents.Grid
    @代码{
    单纯形网格;
    受保护的覆盖无效OnAfterRender(布尔firstRender)
    {
    base.OnAfterRender(firstRender);
    grid.Refresh();//将断点放在这里,然后进入
    }
    }
    
  • 运行应用程序


  • SourceLink需要编辑器的支持。VS2019,骑手支持,VS代码不支持。 要启用VS2019内部调试,请禁用
    仅我的代码
    内部
    工具-选项-调试-常规
    
    
    SourceLink需要编辑器的支持。VS2019,骑手支持,VS代码不支持。 要启用VS2019内部调试,请禁用
    仅我的代码
    内部
    工具-选项-调试-常规
    
    

    正确
    

    
    
    这还不够。我还要补充一点:

    <PropertyGroup>
      <EmbedUntrackedSources>true</EmbedUntrackedSources>
      <DebugType>embedded</DebugType>
    </PropertyGroup>  
    
    <PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
      <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    </PropertyGroup>
    
    
    真的
    嵌入的
    真的
    
    然后,我可以进入从github下载的nuget源代码

    
    
    这还不够。我还要补充一点:

    <PropertyGroup>
      <EmbedUntrackedSources>true</EmbedUntrackedSources>
      <DebugType>embedded</DebugType>
    </PropertyGroup>  
    
    <PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
      <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    </PropertyGroup>
    
    
    真的
    嵌入的
    真的
    
    然后我就可以进入从github下载的nuget源代码

    <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
    
    <PropertyGroup>
      <EmbedUntrackedSources>true</EmbedUntrackedSources>
      <DebugType>embedded</DebugType>
    </PropertyGroup>  
    
    <PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
      <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
    </PropertyGroup>