christianhelle / apiclientcodegen

A collection of Visual Studio custom tool code generators for Swagger / OpenAPI specification files
http://bit.ly/restapicodegen
GNU General Public License v3.0
177 stars 23 forks source link

Refit dependency is added when the dependency is already met in a Transient package reference #941

Open dammitjanet opened 3 months ago

dammitjanet commented 3 months ago

Describe the bug I have a project where I already have Refit 7.0.0 as a transient package reference from including Refit.HttpClientFactory (although almost nay other package or project could theoretically also bring Refit into the transient dependency list), but every time I regenerate the code from the .refitter file, Refit is re-added and there is no need to.

Support Key: ecbee24

To Reproduce Steps to reproduce the behavior:

  1. Create a project
  2. Add Refit.HttpClientFactory as a package reference
  3. Add a refitter file and generate
  4. remove the Refit 7.0.0 package reference
  5. Right click the .refitter file and 'Generate Refitter output'

Expected behavior The tool to recognise that the Refit dependency is already met and not add it explicitly

Screenshots n/a

Visual Studio Extension (please complete the following information):

Additional context This is quite a low priority issue, but I expect it can also happen with any of the other code generators not just Refit.

christianhelle commented 3 months ago

@dammitjanet thanks for taking the time to report this. I'll see what I can do

christianhelle commented 3 months ago

@dammitjanet I unfortunately completely forgot about this. For now, you can disable the feature Automatically installing missing NuGet packages under the Tools -> Options -> REST API Client Code Generator

image

I'm considering removing the NuGet-related features in my extension as the dependencies required for NuGet integration rely on ancient Visual Studio COM libraries, preventing me from making a single VSIX package that supports multiple versions of Visual Studio.