Nic*_* BL 7 c# visual-studio sourcelink
如何为VisualLink公开的库代码启用Visual Studio"Go to implementation"?
我们最近开始在我们的.NETcore库中使用SourceLink,试图在使用它时调试库.我们使用这个项目启用了SourceLink:ctaggart/SourceLink,通过在csproj中添加以下行:
<PackageReference Include="SourceLink.Embed.AllSourceFiles" Version="2.6.0" PrivateAssets="All" />
Run Code Online (Sandbox Code Playgroud)
这非常有效,因为我现在能够使用调试器进入库代码,但我无法跳转到任何此库代码的实现/定义.有没有办法让视觉工作室做到这一点?
SourceLink 现在是https://github.com/dotnet/sourcelink/上的 .NET Foundation 项目。
首先,配置源链接的行为方式:
您可以通过设置一些属性并将 PackageReference 添加到 SourceLink 包来在自己的项目中启用 SourceLink 体验:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Optional: Include the PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<!-- Add PackageReference specific for your source control provider (see below) -->
</ItemGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)
然后,添加与您的存储库匹配的源链接包。软件包目前处于预发布状态,可用的软件包如下:
github.com 和 GitHub Enterprise
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
Visual Studio 团队服务
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
团队基础服务器
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.Tfs.Git" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
<SourceLinkTfsGitHost Include="tfs-server-name" VirtualDirectory="tfs"/>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
GitLab
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
Bitbucket.org
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.Bitbucket.Git" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
487 次 |
| 最近记录: |