{"record":{"id":"1731f054a14e1a2d","repo":"OpenAPITools/openapi-generator","slug":"source-generation-is-only-compatible-with-net-7-o","errorCode":null,"errorMessage":"Source generation is only compatible with .Net 7 or later.","messagePattern":"Source generation is only compatible with \\.Net 7 or later\\.","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java","lineNumber":962,"sourceCode":"                additionalProperties.put(\"apiDocPath\", apiDocPath + File.separatorChar + \"apis\");\n                additionalProperties.put(\"modelDocPath\", modelDocPath + File.separatorChar + \"models\");\n                break;\n        }\n\n        if (useDateOnly()) {\n            setSupportsDateOnly(true);\n            additionalProperties.put(\"supportsDateOnly\", true);\n        }\n        // include the spec in the output\n        supportingFiles.add(new SupportingFile(\"openapi.mustache\", \"api\", \"openapi.yaml\"));\n\n        this.setTypeMapping();\n    }\n\n    @Override\n    public void setUseSourceGeneration(final Boolean useSourceGeneration) {\n        if (useSourceGeneration && !this.additionalProperties.containsKey(NET_70_OR_LATER)) {\n            throw new RuntimeException(\"Source generation is only compatible with .Net 7 or later.\");\n        }\n        this.useSourceGeneration = useSourceGeneration;\n    }\n\n    @Override\n    public CodegenOperation fromOperation(String path,\n                                          String httpMethod,\n                                          Operation operation,\n                                          List<Server> servers) {\n        CodegenOperation op = super.fromOperation(path, httpMethod, operation, servers);\n\n        if (this.operationParameterSorting == SortingMethod.ALPHABETICAL) {\n            Collections.sort(op.allParams, parameterComparatorByName);\n            Collections.sort(op.bodyParams, parameterComparatorByName);\n            Collections.sort(op.pathParams, parameterComparatorByName);\n            Collections.sort(op.queryParams, parameterComparatorByName);\n            Collections.sort(op.headerParams, parameterComparatorByName);\n            Collections.sort(op.implicitHeadersParams, parameterComparatorByName);","sourceCodeStart":944,"sourceCodeEnd":980,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java#L944-L980","documentation":"Error \"Source generation is only compatible with .Net 7 or later.\" thrown in OpenAPITools/openapi-generator.","triggerScenarios":"Thrown when source generation is enabled for the C# client generator while targeting a .NET version older than .NET 7. Target net7.0 or later, or disable source generation.","commonSituations":"See trigger scenarios.","solutions":["Target .NET 7 or later when using source generation, e.g. set targetFramework=net7.0 (or newer), or disable the source generation option."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}