0
votes

I am currently trying to enable a nuget library to debug locally in a CI/CD process.

The current situation

I have a build configuration on Azure Devops which is using an Ubuntu agent. The build publishes artifacts and the release pipeline packs/pushes the nuget package to Azure Artifacts.

First I tried by using the snupkg format to publish the pdb files but those are not supporting within Azure Artifacts. https://developercommunity.visualstudio.com/t/add-snupkg-support-to-azure-devops-artifacts/657354

I tried to follow this tutorial. https://docs.microsoft.com/en-us/azure/devops/artifacts/symbols/setting-up-github-sourcelinking?view=azure-devops

First obstacle is that the task to publish a symbol publish does not work on Linux but solely on Windows. https://github.com/microsoft/azure-pipelines-tasks/issues/5919

Therefore I didn't have much luck using the symbol server. I found a workaround by adding the following in the .csproj file

        <EmbedUntrackedSources>true</EmbedUntrackedSources>
        <PublishRepositoryUrl>true</PublishRepositoryUrl>
        <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

Now the symbols are packed within the nuget file but still not loaded automatically when I am using the package in visual studio. (I unchecked Enable just my code in VS)

When I am adding them manually in the Modules windows in Visual Studio, it works.

Is there any way to build up the CI/CD process with Linux agents in Azure Devpos to get the Symbols working correctly? Alternatively can VS automatically load the symbols when it loads the nuget package?

My project is .net standard 2.1/.net framework 5. Builds: Azure Devops (Ubuntu agent) Nuget repository: Azure Artifacts Visual studio: VS 2019 16.8.4

All help us much appreciated.

Thanks

1

1 Answers

1
votes

Now the symbols are packed within the nuget file but still not loaded automatically when I am using the package in visual studio. (I unchecked Enable just my code in VS)

For this issue, this is expected behavior. Usually we use Index Sources & Publish Symbols task to publish symbols to the symbols server in Azure Artifact (Azure Artifacts offers a dedicated symbols server to publish your symbols). Then In Visual Studio, add new symbol server (the organization which owns the pipeline and hosts the artifact feed). After configuration, Visual Studio will establish connection to the symbols server and attempt to locate the symbols.

enter image description here

Since you only pack the symbols in the nuget file and do not publish symbols to the symbols server. Therefore, symbols will not be automatically loaded in VS.

So you need to manually add them in the "Modules" window of Visual Studio to make it work.

If you want VS automatically load the symbols, in azure pipeline, you can try to use two agent jobs, use windows agent in the second agent job to run Index Sources & Publish Symbols task to publish symbols to symbols server in Azure Artifact.