我的 gitlab 项目中托管了一些 nuget 包。而且我需要调试这个包并且不能在 Visual Studio for Mac 上这样做。这是我的 csproj 文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp3.1</TargetFrameworks>
<!-- 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: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<!-- Recommended: Embed symbols containing Source Link in the main file (exe/dll) -->
<DebugType>embedded</DebugType>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<EmbedAllSources>true</EmbedAllSources>
<PackageVersion>1.0.18.0</PackageVersion>
<AssemblyVersion>1.0.18.0</AssemblyVersion>
<FileVersion>1.0.18.0</FileVersion>
<InformationalVersion>1.0.18.0</InformationalVersion>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard2.0')) Or $(TargetFramework.StartsWith('netstandard2.1'))">
<PackageReference Include="nlog" Version="4.6.2" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0" PrivateAssets="All"/>
<Compile Include="ISynchronizationContext.cs" />
<Compile Include="TaskExtensions.cs" />
<Compile Include="AsyncAwaiter.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('netcoreapp3.1'))">
<PackageReference Include="Microsoft.SourceLink.GitLab" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="nlog" Version="4.6.2" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<Compile Include="*.cs" />
</ItemGroup>
<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
</Project>
这是我的 .gitlab-ci.yml 部署部分:
deploy:
stage: deploy
script:
- dotnet pack -c Release
- dotnet nuget add source "$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name $CI_PROJECT_TITLE --username $CI_REGISTRY_USER --password $CI_REGISTRY_PASSWORD --store-password-in-clear-text
- dotnet nuget push "Source/bin/Release/*.nupkg" --source $CI_PROJECT_TITLE
调试在 Visual Studio 2019 中工作的 nuget 包,但在 Visual Studio for Mac 中不工作。在这篇文章中,我读到:
在 Visual Studio for Mac 中,尚不存在对符号服务器的支持,因此 Source Link 仅适用于包含其自己的调试符号的 NuGet 包。
我需要做什么才能在 Visual Studio for Mac 中调试我的 nuget 包?