@autorest/csharp

中文文档
3.0.0-beta.20251203.1发布于 2025/12/04TypeScriptES Module零依赖近 30 天下载 6793

See readme.md for details

原始使用文档
文档目录3 节
  1. Configuration
  2. Customization
  3. Help

AutoRest.CSharp

see https://aka.ms/autorest

Configuration

use-extension:
  "@autorest/modelerfour": "4.26.0"
modelerfour:
  always-create-content-type-parameter: true
pipeline:
  csharpgen:
    input: modelerfour/identity
  csharpgen/emitter:
    input: csharpgen
    scope: output-scope
output-scope:
  output-artifact: source-file-csharp
shared-source-folders: $(this-folder)/Generator.Shared;$(this-folder)/Azure.Core.Shared
modelerfour:
  flatten-models: true
  flatten-payloads: true
  group-parameters: true
use-extension:
  "@autorest/testmodeler": "2.6.1"

pipeline:
  test-modeler:
    input: modelerfour/identity
    scope : output-scope
  test-modeler/identity:
    input: test-modeler
  csharpgen:
    input: test-modeler/identity

modelerfour:
  emit-yaml-tags: true

testmodeler:
  use-parents-value: true
  split-parents-value: false
  add-armtemplate-payload-string: true

include-x-ms-examples-original-file: true
#   export-explicit-type: true

Customization

directive:
  - from: swagger-document
    where: $.definitions.PrivateEndpointConnectionProperties
    transform: >
      $.properties.privateLinkServiceConnectionState["x-ms-client-name"] = "connectionState";   

Help

help-content:
  csharp: # type: Help as defined in autorest-core/help.ts
    activationScope: csharp
    categoryFriendlyName: C# Generator
    settings:
    - key: library-name
      description: The name of your library. This is what will be displayed on NuGet.
      type: string
    - key: shared-source-folders
      description: Pass shared folder paths through here. Common values point to the shared generator assets and shared azure core assets in autorest.csharp
      type: string
    - key: public-clients
      description: Whether to generate public client. Defaults to `false`.
      type: bool
    - key: model-namespace
      description: Whether to add a separate namespace of Models, more specifically adding `{value-from-namespace-flag}.Models`. Defaults to `true`.
      type: bool

版本与发布记录

@autorest/csharp 共发布 1,871 个版本,首次发布于 2020/12/18;过去 12 个月发布了 1 个版本。

版本发布日期距今
3.0.0-beta.20251203.1latest2025/12/0411 个月前
3.0.0-beta.20251023.12025/10/241 年前
3.0.0-beta.20251022.22025/10/231 年前
3.0.0-beta.20251022.12025/10/231 年前
3.0.0-beta.20251012.12025/10/131.1 年前
3.0.0-beta.20250926.12025/09/261.1 年前

关于 @autorest/csharp 的常见问题

@autorest/csharp 是什么?

See readme.md for details

如何安装 @autorest/csharp?

在项目目录运行 npm install @autorest/csharp,或使用 pnpm add / yarn add / bun add。

@autorest/csharp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@autorest/csharp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@autorest/csharp 可以商用吗?

@autorest/csharp 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@autorest/csharp 的下载量有多少?

根据 npm 官方下载统计,@autorest/csharp 在 2026/10/07 – 2026/11/05 这 30 天内被下载 6,793 次,日均约 226 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@autorest/csharp 还在维护吗?

最新版本 3.0.0-beta.20251203.1 发布于 2025/12/04(11 个月前);至今共发布 1871 个版本,其中过去 12 个月发布了 1 个;首次发布于 2020/12/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。