0

I have a library of nuget packages we use throughout our solutions, hosted in Azure Artifacts. These nuget packages are built with debug enabled so symbols are created and included in nuget packages.

Our projects in Visual Studio (mainly Net Core 3.1) reference these nuget packages in the normal way using Nuget Package Manager.

Each solution has SourceLink enabled so if I have any debugging requirements which require stepping into code within the referenced nuget package, I can set a breakpoint and do so quite nicely as Visual Studio downloads the sourcecode directly from Azure Artifacts.

That all works perfectly.

The issue is a productivity one. If code within the nuget package needs to be changed, I have to open the solution for the nuget package, change it, push it and wait for Azure to build. When built, I go to Nuget Package Manager, update the package, restart the app and 'hopefully' have resolved the issue. For something tricky, I can loop this process a few times which is a productivity killer.

Is there any way to debug directly in the solution for the nuget package from the solution referencing it? Or does anybody have a better process they use which is more productive?

1
  • Assuming you're using PackageReference, and not packages.config, temporarily change the PackageReference to a ProjectReference. Just take care to not accidentally check in the project changes, although that should fail CI so hopefully you won't be able to merge a PR that does that anyway. If you're using packages.config, you could try adding a ProjectReference, and see what happens. I'm not sure if it's necessary to remove the package, but with a bit of hand editing the csproj it's doable. Commented Nov 20, 2020 at 17:11

2 Answers 2

1

You may try to use floating version that can resolve to the latest version in nuget. In this way, when there is updated package, your solution will load the latest version of the package during build.

<ItemGroup>
    <PackageReference Include="NuGet.Packaging" Version="*" />
</ItemGroup>
Sign up to request clarification or add additional context in comments.

Comments

0

Is there any way to debug directly in the solution for the nuget package from the solution referencing it?

Using project reference instead of the nuget package when you need to frequently modify and debug the source code in the nuget package.

When you consider production efficiency, please consider using project reference, when you consider portability, please try to use nuget. You could check my previous thread for detailed explanation.

For your situation, you could add the project for the nuget package to your referencing solution by the option Existing project

enter image description here

Then select the project file .csproj for the nuget package.

After adding that project into your solution, you could add that project as project reference for your referencing project. Now, you could directly modify and debug the project for the nuget package.

When you finish this stage of work, you can return to the solution where the project for the nuget package is located, pack the new version of the nuget package and publish it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.