swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Dot NET Core 2.0 client

Open MCerk opened this issue 8 years ago • 5 comments

Hello,

I have found a solution, how to generate .NET CORE 2.0 compatible client code (csharp). The RestSharp nuget should be pointed to version 6.2.1 and there should be only one line of code changed in file:

swagger-codegen/modules/swagger-codegen/src/main/resources/csharp/ApiClient.mustache

Line no.: 156

From:

request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType);

to:

request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentLength, param.Value.ContentType);

Cheers,

Matej

MCerk avatar Mar 21 '18 23:03 MCerk

Hi, I am just about to try this, but is there any chance you were able to generate a working Server Stub using swagger-codegen? I have been trying for some time, but the solution won't load in VS2017. Any idea on what I might be doing wrong? See #7892 for details on my issue. Cheers,

AuroraBrignola avatar Mar 26 '18 09:03 AuroraBrignola

Sorry, I have not yet tested the server stub. Cheers.

MCerk avatar Mar 26 '18 11:03 MCerk

@AuroraBrignola for me it looks like the "project type GUID" is incorrect Solution (.Sln) File. If you change this GUID to a valid, visual studio can load this project from the solution file.

Simple workaround would be to delete the project from your current solution and add it again as existing project - then visual studio creates a new type project GUID - and everything works fine.

best, regards

planbsim avatar Mar 26 '18 12:03 planbsim

@planbsim Thanks a lot, that worked and also made me figure out that there was an issue already opened for this, it just wasn't merged into master.

AuroraBrignola avatar Mar 26 '18 13:03 AuroraBrignola

@mandrean I've submitted a PR with the fix described above as well as another compilation issue regarding url encoding of strings.

https://github.com/swagger-api/swagger-codegen/pull/8421

conductxr avatar Jul 13 '18 04:07 conductxr