Search code examples
c#referencecsproj

PackageReference and PackageReference to same project


Let's assume I have a library project (ProjA) and a second project (projB) that uses projA. ProjA is published as a nuget package. Both projects have their own git repositories

In projB I have a reference to the nuget package for projA

But when I want to add some changes to both projects or check something in the library implementation, I add projA to the solutions folder in projB (using: add>Existing project). Then I need to add the project reference to projA and comment out or remove the line with the nuget reference to projA.

Is there any solution that allows me to work on both projects without manually changing the references?

Is it possible to use a project reference during development and use a nuget package reference in the published project? Maybe, using some condition in or in csproj file?


Solution

  • Perhaps:

    <ProjectReference Condition="'$(Configuration)' == 'Debug'".../>
    <PackageReference Condition="'$(Configuration)' != 'Debug'".../>