autorest.csharp: csharp generator v3 does not generate .Net clients
I was prompted to upgrade AutoRest to latest. Generated code now targets Azure only
autorest readme.md
contents of readme.md
input-file: https://internal.site/api/swagger/docs/v0
output-folder: ..\..\OpenApi\Generated
add-credentials: true
use-internal-constructors: true
sync-methods: none
csharp:
namespace: OpenApi
Expected behavior Auto-generated code targeting .NET
Additional context
I didn’t see anything anywhere about support for generating clients targeting .NET having been dropped. The only pointer I found was about using version=previous
, if having problems with current version. What do I need to add to make sure vanilla .NET clients are being generated, using V3?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (7 by maintainers)
@timotheeguerin is correct. V3 generator depends on Azure.Core and we do not have any plan to support non Azure template.
Hey, just checking in one year later, I am having the exact same issues, using this tool looks impossible to me outside an Azure environment. The documentation only shows azure-arm flavor of client initialization and nothing on how to provide those constructor parameters, namely
ClientDiagnostics
andHttpPipeline
Would appreciate input on this
PS. @ShivangiReja the repo you provided, does not initialize and use the generated client, or am I missing something?
Any updates on this? We are actively using AutoRest to generate internal clients and if it is confirmed that non-Azure template will be dropped we will have to plan switch now, instead of using --v2 flag for some time.
@aanufriyev and @NelsonLamprecht:
I meant we depend on Azure.Core and we don’t have any plan to support
Microsoft.Rest.ClientRuntime
(non Azure) library.Confirming that this package is now only for consuming azure rest services and not any rest services? If so, I think it would be helpful for users to remove the section in the readme about “Use outside of the azure-sdk-net repo” and boldly proclaim autorest.csharp is not to be used to generate clients for non azure resources which appears to be a deviation from the proclaimed goals on the base autorest page: “The AutoRest tool generates client libraries for accessing RESTful web services”.
Maybe this package should be renamed autorest.csharp-azure since they are comingled?
How interesting @ShivangiReja, thank you. I really like the way the generated code looks now in V3.
@timotheeguerin the generated code targets azure, not plain .net. The client generated depends on Azure libraries, not on
Microsoft.Rest.ClientRuntime
. Meanwhile I headed over tocsharp
generator issues https://github.com/Azure/autorest.csharp/issues/1029 and it is admitted V3 is missing vanilla .NET support, if I get that epic right.There doesn’t seem to be any way out of generating that Azure targeting code.
V3 generator also generates .csproj check here, it references
Azure.Core
andMicrosoft.Azure.AutoRest.CSharp
. That’s where these parameters come from.