79185415

Date: 2024-11-13 14:50:53
Score: 0.5
Natty:
Report link

Managed to configure SourceLink + Azure DevOps Symbols Server with the help of this video:

No need for additional project file configurations if .NET version is >= 8

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

    <PropertyGroup>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

</Project>

Azure DevOps pipeline YAML file

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- master

pool:
  vmImage: windows-latest

steps:
- task: DotNetCoreCLI@2
  inputs: 
    command: 'pack'
    packagesToPack: '**/*.csproj' 
    versioningScheme: 'byPrereleaseNumber'
    majorVersion: '1'
    minorVersion: '0'
    patchVersion: '0'

- task: DotNetCoreCLI@2
  inputs: 
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
    nuGetFeedType: 'internal'
    publishVstsFeed: 'c4a7af6d-9593-4a8f-ab27-07194500dea0'

- task: PublishSymbols@2
  inputs:
    SearchPattern: '**/bin/**/*.pdb'
    IndexSources: false
    SymbolServerType: 'TeamServices'

VS Debugging settings

Don't forget to grant the necessary access permissions to your project build service in your feed's settings. I've spent some time until I figured why the Push task was failing all the time.

Artifacts -> YourFeed -> Feed Settings (gear icon) -> Permissions -> Add users/groups. Start typing your project's name, and it will appear there as "YourProjectName Build Service (YourOrgName)". Grant it the Feed Publisher permissions.

Reasons:
  • Blacklisted phrase (1): this video
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: desmondische