0
votes

I am working on Azure DevOps pipeline where I publish a NuGet Feed. The feed has abc.dll and abc.pdb files. The consumer of my feed is able to get abc.dll and abc.pdb into their bin folder. They are also able to call methods in abc.dll.

My question is how to include source code into PDB files. I want the consumer of my feed to step into code while debugging. Currently, when they do they get a message saying source code file is not found.

I know its security risk to let others know your code but we just want to try and see how it works. I don't want consumer to do anything. Just get my feed, call methods, and step into code.

UPDATE

I was able to solve the issue following below. I added my source code files in my package and consumer is able to get them to their local machine and was able to step into the code.

Is it possible to host both regular and symbols packages in a NuGet local feed on a network share?

But I am concerned that I have many source code files and that will lead to size of my feed to increase and also I do not want my source code files to be downloaded to consumer local machine.

I was able to publish symbols using Index Sources & Publish Symbols task in Azure DevOps pipeline but I am getting error saying my source code file is not found on consumer side when they try to debug and step into code. I tried below but not works.

https://docs.microsoft.com/en-us/azure/devops/artifacts/symbols/debug-with-symbols-visual-studio?view=azure-devops

How do we really debug code which was a result of Index Sources & Publish Symbols task ?

SOLUTION

I am able to solve the issue following exact steps in below links

https://marcduerst.com/2018/01/11/how-to-build-and-publish-nuget-packages-with-source-symbols-to-vsts/

https://docs.microsoft.com/en-us/azure/devops/artifacts/symbols/debug-with-symbols-visual-studio?view=azure-devops

1
How do you pack the NuGet package?Shayki Abramczyk
I created a Azure DevOps Build pipeline with Build, Copy Files, NuGet Pack, and NuGet Push tasks. In NuGet Push I give name of my Feed for Target Feed Property...Ziggler

1 Answers

1
votes

Azure DevOps NuGet Feed consumer step into source code

That document is mainly introducing the task Index Sources & Publish Symbols task, a little about how to debug the package. And this task is used to publish symbols to the symbol server in Azure Artifacts, so that we could use indexed symbols to debug our app.

If we want to step into source code, just like you said, we need include source code. But we could not include source code into PDB files, because that is only a symbol server in Azure Artifacts, we could not include source code. Even if we could include source code into PDB files, we still could not step into source code, because Visual Studio/MSBuild could not know which source code should to be used.

The Symbol servers enable debuggers to automatically retrieve the correct symbol files but not source code without knowing product names, build numbers, or package names.

So, to resolve this issue, we have to include the source code in the nuget package instead of PDB files. Then we could specify the source code in the Visual Studio.

Check the detailed steps from my answer in another thread:

  • Put the pdb and source code file in the NuGet package alongside the dll.
  • Add the source code to the Debug Source Files for the solution that references the package.

Hope this helps.