Azure DevOps SourceLink 和 Symbol Server 以及 Nuget 包中的 Release DLL

Jér*_*VEL 11 symbol-server nuget nuget-package sourcelink azure-devops

我有一个 .NET Standard 2.0TestSouceLink项目,其配置如下.csproj

<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
    <Authors>Jérôme MEVEL</Authors>
    <Description>Just a test package for SourceLink</Description>
    <Version>1.1.1</Version>

    <PublishRepositoryUrl>true</PublishRepositoryUrl>
    <EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
</PropertyGroup>

<ItemGroup>
    <PackageReference Include="Microsoft.SourceLink.Vsts.Git" Version="1.0.0-beta2-18618-05">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
</ItemGroup>
Run Code Online (Sandbox Code Playgroud)

我们有一个 Azure DevOps 服务器,它在构建管道中生成我们的 Nuget 包。

Publish symbols path在最后添加了一个任务来将.pdb文件推送到 Symbol Server,并且我设法让 Source Link 与 Azure DevOps Symbol Server 一起工作,仅使用Debug构建配置。

问题是我不希望在调试模式下生成 Nuget 包中的 DLL。我希望它们是Release。但是当我将dotnet pack任务更改为ReleaseConfiguration to package文本框中使用时,源链接不再起作用。

有没有办法生成一个带有 Release DLL 的 Nuget 包?并且仍然让 Source Link 与 Symbol Server 一起工作?

如果这是唯一的方法,我不介意将.nuspec文件与NugetCLI一起使用,但是我不想将这些.pdb文件包含在 Nuget 包中。

谢谢