Override nuget package link with local project link

I would like iteration in the nuget package without continuously clicking on the package in the nuget feed.

I am wondering if it is possible to conditionally add a link to a project instead of a link to a nuget package through a target or props file in csproj files, which will allow me to debug my nuget package locally.

In my csproj, I would:

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

and localOverrides.props will be the file specified in my .gitignore, which developers could add lines to the text:

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

Am I really wrong? Of course, there should be a more robust way to quickly iteratively debug a nuget package, and then create packages before release with every change

+5
source share
3 answers

As I always debugged a Nuget package, once you added this package to your solution through Nuget, you then make changes to the Nuget DLL and simply copy them to the desired folder in the package folder for the project consuming the Nuget package.

All you have to do is compile the solution, which the solution of the Nuget project is in debug mode, and just copy / paste them into the consumer packages package folder. You could make it even easier by writing a script package and adding it as a post-build event to a Nuget project, which just copied the DLLs to the right folder for you.

+2
source

If all you want to do is debug the NuGet package, I suggest you use the "dotpeek debug server" option. This way you don’t have to do anything with the link and just debug the package or whatever. https://confluence.jetbrains.com/plugins/servlet/mobile#content/view/53336814

0
source

It looks like you need a test project (block or integration) in the same solution as your batch NuGet build project. Then you can prove its correctness regardless of any consumers of the NuGet package. Good tests will also help ensure that you don't break anything inadvertently when upgrading a package in the future.

0
source

Source: https://habr.com/ru/post/1247162/


All Articles