Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override a nuget package reference with a local project reference

I'd like iterate on a nuget package without continuously pushing the package to a nuget feed.

I'm wondering if it's possible to conditionally add a project reference instead of a nuget package reference via a target or props file in csproj files that would allow me to locally debug my nuget package.

In my csproj I would have:

<Reference Include="A">
    if(Exists(localOverrides.props) {
        <HintPath>localOverrides.A.HintPath</HintPath>
    } else {
        <HintPath>..\packages\A.dll</HintPath>
    }
</Reference>

and localOverrides.props would be a file listed in my .gitignore that developers could add lines to like:

A -> C:\Repos\A\bin\A.dll

Am I on the wrong path? Surely there must be a more sustainable way to quickly iterate and debug a nuget package then creating pre-release packages on every change

like image 594
Valchris Avatar asked Apr 15 '16 00:04

Valchris


1 Answers

The way I have always debugged Nuget package is once you have that package added to your solution through Nuget, you then make changes to the Nuget DLLs and just copy them into the correct folder in the packages folder for the project consuming the Nuget package.

All you have to do is compile the solution that Nuget project solution in debug mode and just copy/paste them into the consuming project's packages folder. You could make this even simpler by writing a batch script and adding it as a post build event to the Nuget project that just copied the DLLs into the correct folder for you.

like image 144
Dmitry K. Avatar answered Nov 15 '22 10:11

Dmitry K.