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

Is .NET 8 SDK Required? #1013

Open carminoplata opened 1 week ago

carminoplata commented 1 week ago

Hi,

I'm dealing with this error when I try to generate code from swagger.json Impossible load file or assembly System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51.

Do I need to download and use SDK .NET 8?

Support Key: 9ca55a7 Found in Tools -> Options -> REST API Client Code Generator - Analytics

To Reproduce Using only .NET 7 SDK and ASP.NET Core Runtime 8.0.10, Install REST API Client Code Generator for VS 2022

christianhelle commented 1 week ago

@carminoplata Thanks for taking the time to report this.

This is probably a bug that was introduced recently. The System.Text.Json version needs to be aligned with what Refitter, NSwag, and this Visual Studio extension uses. I remember merging a couple of Dependabot pull requests for System.Text.Json due to Microsoft Security Advisory CVE-2024-43485 which was most likely the cause of this

I'll fix this as soon as I can

christianhelle commented 1 week ago

@carminoplata I just did some testing on the current released version (v1.14.0) and I can't seem to reproduce your error. Do you know what version of this extension you are using? Maybe upgrading to the latest version would help.

I tried out the latest version (v1.14.0) on the latest Visual Studio 2022 (v17.12.0 )

christianhelle commented 1 week ago

Do I need to download and use SDK .NET 8?

No, you don't need .NET 8 to run the extension. For historical reasons, Visual Studio extensions are written using .NET Framework 4.8.

Also, as far as I know, the .NET 8.0 SDK comes with Visual Studio 2022

carminoplata commented 1 week ago

@carminoplata I just did some testing on the current released version (v1.14.0) and I can't seem to reproduce your error. Do you know what version of this extension you are using? Maybe upgrading to the latest version would help.

I tried out the latest version (v1.14.0) on the latest Visual Studio 2022 (v17.12.0 ) I'm using latest version 1.14.0 and Visual Studio 2022 (v17.7.6)

In addition, I'm dealing with this error when I try to generate Client using Refitter from a swagger generated via nswag studio. Using Generate with NSwag (14.1.0), I don't have any issue except for the multiple delcarations of the same _httpClient into multiple interfaces and partial classes inside the generated Client.cs.