dotnet new 的 .NET 預設範本

资讯 2024-07-09 阅读:47 评论:0
文章04/25/2024...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

當您安裝 .NET SDK 時,您會收到十多個用於建立專案和檔案的內建範本,包括主控台應用程式、類別庫、單元測試專案,ASP.NET Core 應用程式 (包括 AngularReact 專案) 和組態檔。 若要列出內建範本,請執行 命令:

When you install .NET SDK, you will receive more than a dozen built-in templates for the creation of projects and files, including master control programme applications, databases, unit testing projects, ASP.NET Core applications (including Angular and ) and integration files.


下表顯示隨 .NET SDK 預先安裝的範本。 範本的預設語言會顯示在方括號內。 按一下簡短名稱連結即可查看特定範本選項。

The following table shows the templates that were pre-installed with.NET SDK. The default language of the template is shown in square brackets. A short name link allows you to see the selected template options.

範本 簡短名稱 語言 標籤 推出的版本
主控台應用程式 [C#], F#, VB 通用/主控台 1.0
類別庫 [C#], F#, VB 通用/程式庫 1.0
WPF 應用程式 [C#]、VB 一般/WPF 3.0 (VB 為 5.0)
WPF 類別庫 [C#]、VB 一般/WPF 3.0 (VB 為 5.0)
WPF 自訂控制項程式庫 [C#]、VB 一般/WPF 3.0 (VB 為 5.0)
WPF 使用者控制項程式庫 [C#]、VB 一般/WPF 3.0 (VB 為 5.0)
Windows Forms (WinForms) 應用程式 [C#]、VB 一般/WinForms 3.0 (VB 為 5.0)
Windows Forms (WinForms) 類別庫 [C#]、VB 一般/WinForms 3.0 (VB 為 5.0)
背景工作服務 [C#] 一般/背景工作/Web 3.0
單元測試專案 [C#], F#, VB 測試/MSTest 1.0
NUnit 3 測試專案 [C#], F#, VB 測試/NUnit 2.1.400
NUnit 3 測試項目 [C#], F#, VB 測試/NUnit 2.2
xUnit 測試專案 [C#], F#, VB 測試/XUnit 1.0
Razor 元件 [C#] Web/ASP.NET 3.0
Razor 頁面 [C#] Web/ASP.NET 2.0
MVC ViewImports [C#] Web/ASP.NET 2.0
MVC ViewStart [C#] Web/ASP.NET 2.0
Blazor Web 應用程式 [C#] Web/Blazor 8.0.100
BlazorWebAssembly 獨立應用程式 [C#] Web/Blazor//WebAssemblyPWA 3.1.300
空的 ASP.NET Core [C#]、F# Web/空白 1.0
ASP.NET Core Web 應用程式 (模型檢視控制器) [C#]、F# Web/MVC 1.0
ASP.NET Core Web 應用程式 [C#] Web/MVC/Razor 頁面 2.2,、2.0
Razor 類別庫 [C#] Web/Razor/程式庫/Razor 類別庫 2.1
ASP.NET Core Web API [C#]、F# Web/Web API/API/服務/WebAPI 1.0
ASP.NET Core API [C#] Web/Web API/API/服務 8.0
ASP.NET Core API 控制器 [C#] Web/ASP.NET 8.0
ASP.NET Core gRPC 服務 [C#] Web/gRPC 3.0
dotnet gitignore 檔案 Config 3.0
global.json 檔案 Config 2.0
NuGet 組態 Config 1.0
Dotnet 本機工具資訊清單檔 Config 3.0
Web 組態 Config 1.0
方案檔 解決方案 1.0
通訊協定緩衝區檔案 Web/gRPC 3.0
EditorConfig 檔案 Config 6.0

下表顯示已停止且不再預安裝 .NET SDK 的範本。 按一下簡短名稱連結即可查看特定範本選項。

The following table shows a sample of.NET SDK that has been stopped and is no longer pre-installed. A short name link allows you to see a given template option.

範本 簡短名稱 語言 標籤
ASP.NET Core 與 Angular [C#] Web/MVC/SPA 8.0
ASP.NET Core 與 React.js [C#] Web/MVC/SPA 8.0
Blazor 伺服器應用程式 [C#] Web/Blazor 8.0
Blazor 伺服器應用程式空白 [C#] Web/Blazor 8.0
BlazorWebAssembly 應用程式空白 [C#] Web/Blazor/WebAssembly 8.0

各個範本可能還會有其他可用的選項。 若要顯示範本可用的其他選項,請使用 選項搭配範本名稱引數,例如: 。 如果範本支援多種語言,此命令將會以預設語言顯示範本說明。 藉由將其與 選項結合,您可以看到其他語言的說明:。 隨附於 .NET SDK 的範本有下列其他選項:

There may be other available options for each template. To show other options available for the template, use the menu matching template name quotes, for example: If the template supports multiple languages, the command will show the template in default language. By combining it with the option, you can see the explanation in other languages. The following other options are attached to the template for.NET SDK:






建立舊版 TFM 的專案的能力取決於已安裝該版本的 SDK。 例如,如果您只安裝 .NET 6 SDK,則唯一可用的 值為 。 如果您安裝 .NET 5 SDK,值 就會變成可供使用的 。 如果您安裝 .NET Core 3.1 SDK, 就會變成可用,以此類推。 因此,即使在 .NET 6 SDK 中執行 時,您也可透過指定 將 .NET Core 3.1 為視為目標。

The ability to build an old TFM project depends on the installed version of SDK. For example, if you install only.NET 6 SDK, the only available value is. If you install.NET 5 SDK, the value will become available. If you install.NET Core 3.1 SDK, it will become available. So, even if you run in.NET 6 SDK, you can specify that you will target.NET Core 3.1.


建立舊版 TFM 的專案的能力取決於已安裝該版本的 SDK。 例如,如果您只安裝 .NET 6 SDK,則唯一可用的 值為 。 如果您安裝 .NET 5 SDK,值 就會變成可供使用的 。 如果您安裝 .NET Core 3.1 SDK, 就會變成可用,以此類推。 因此,即使在 .NET 6 SDK 中執行 時,您也可透過指定 將 .NET Core 3.1 為視為目標。

The ability to build an old TFM project depends on the installed version of SDK. For example, if you install only.NET 6 SDK, the only available value is. If you install.NET 5 SDK, the value will become available. If you install.NET Core 3.1 SDK, it will become available. So, even if you run in.NET 6 SDK, you can specify that you will target.NET Core 3.1.


  • 所產生程式碼的命名空間。 預設值是 。

    Namespace for the code generated. Default value is.

  • 不使用 PageModel 建立頁面。

    Do not use PageModel to create a page.


  • 所產生程式碼的命名空間。 預設值是 。

    Namespace for the code generated. Default value is.


自 .NET 8 SDK 起已停止。

stopped since.NET 8 SDK.

  • 要使用的驗證類型。 可能的值是:

    The type of verification to be used. Possible values are:

    • - 無驗證 (預設值)。
    • - 個別驗證。
    • - 使用 Azure AD B2C 的個別驗證。
    • - 單一租用戶的組織驗證。 Entra 外部 ID 租用戶也使用 。
    • - 多個租用戶的組織驗證。
    • - Windows 驗證。
  • 要連接的 Azure Active Directory B2C 執行個體。 搭配 驗證使用。 預設值是 。

    The Azure Active Directory B2C to be connected executes individual bodies. Combining is used for authentication. The default value is.

  • 此專案的登入及註冊原則識別碼。 搭配 驗證使用。

    The login and registration principles for this project are recognized. Matching is used for validation.

  • 此專案的重設密碼原則識別碼。 搭配 驗證使用。

    The reset password recognition for this project. Combining is used for validation.

  • 此專案的編輯設定檔原則識別碼。 搭配 驗證使用。

    The edit profile principle recognition for this project. Combining is used for validation.

  • 要連接的 Azure Active Directory 執行個體。 搭配 或 驗證使用。 預設值是 。

    The Azure Active Directory to connect to execute bodies. Combining or authentication for use. Default value.

  • 此專案的用戶端識別碼。 搭配 、 或 驗證使用。 預設值是 。

    The client identification code for this project. Combining or authentication for use. Default value is.

  • 目錄租用戶的網域。 搭配 或 驗證使用。 預設值是 。

    The domain of the directory tenant. Combining or authenticating use. Default value is.

  • 要連接的目錄 TenantId 識別碼。 搭配 驗證使用。 預設值是 。

    The directory TenantId identifier to connect. The combination is used for authentication. The default value is.

  • 重新導向 URI 的應用程式基底路徑內的要求路徑。 搭配 或 驗證使用。 預設值是 。

    Redirects the required path within the application base path to URI. The combination or authentication is used. The default value is.

  • 允許此應用程式對目錄的讀取權限。 僅適用於 或 驗證。

    Allows this application to read permissions to directories. Only applies to or authenticates them.

  • 從產生的範本中排除 launchSettings.json

    Exclude launchSettings.json from the resulting template.

  • 關閉 HTTPS。 此選項僅適用於未針對 使用 、、 或 時。

    Closes HTTPS. This option is only appropriate when not used, or when.

  • 指定應該使用 LocalDB,不使用 SQLite。 僅適用於 或 驗證。

    Specifies that a LocalDB should be used, not SQLite. Only suitable for validation or authentication.

  • 專案建立期間不執行隱含還原。

    Unexecuted implicit restoration during project creation.

  • 用於 launchSettings.json 中 HTTP 端點的連接埠號碼。

    The port number of the HTTP peer used in LaunchSettings.json.

  • 用於 launchSettings.json 中 HTTPS 端點的連接埠號碼。 使用 參數 時不適用此選項 (但在為 選擇個人或組織驗證設定時會忽略 )。

    The port number of the HTTPS endpoint used in LaunchSettings. json. This option is not suitable when using parameters (but will be ignored when selecting a person or organization to verify the settings).

  • 若有指定,則會使用明確的 類別和 方法,而不是最上層陳述式。 自 .NET SDK 6.0.300 起提供使用。 預設值: 。

    If specified, the specified categories and methods are used instead of the top presentation. Use is provided from. NET SDK 6.0.300. Default:






自 .NET 8 SDK 起已停止。

stopped since.NET 8 SDK.


  • 專案建立期間不執行隱含還原。

    Unexecuted implicit restoration during project creation.

  • 除了元件之外,支援將傳統 Razor 頁面及檢視新增至此程式庫。 自 .NET Core 3.0 SDK 起提供使用。

    Supports the addition of traditional Razor pages and views to this library, in addition to the widgets. Use is available from.NET Core 3.0 SDK.


使用已啟用 AOT 發佈的 Web API 專案。 如需詳細資訊,請參閱原生 AOT 部署 (英文) 和 Web API (原生 AOT) 範本 (部分機器翻譯)。

Use the AOT-enabled Web API project. See



具有或不含讀取/寫入動作的 API 控制器。

API controller with or without reading/writing actions.

  • 所產生程式代碼的命名空間。 預設值為 。

    Namespace for the resulting code. Default value.

  • 建立具有讀取/寫入動作的控制器。 預設值為 。

    Create a controller with read/ write action. Default value.


  • 指定要在 global.json 檔案中使用的 .NET SDK 版本。

    Specifies the.NET SDK version to be used in the global.json file.

建立 .editorconfig 檔案以設定程式碼樣式偏好設定。

Creates . editorconfig files to configure code style preferences.

  • 建立空白的 .editorconfig,而非 .NET 的預設值。

    Creates a blank . editorconfig instead of the default.NET value.

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 区块链社区有哪些?区块链社区是什么?

    区块链社区有哪些?区块链社区是什么?
    展开全文...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • 0.00015693个比特币等于多少人民币/美金

    0.00015693个比特币等于多少人民币/美金
    0.000 15693比特币等于多少人民币?根据比特币对人民币的最新汇率,0.000 15693比特币等于10.6 1678529美元/76.86554996人民币。比特币(BTC)【比特币价格翻倍】美元(USDT)人民币(CNY)0.000/克洛克-0/5693【数字货币矿机】10.6 167852976.8655254996比特币对人民币的最新汇率为:489,807.72 CNY(1比特币= 489,807.72人民币)(1美元=7.24人民币)(0.00015693 U...
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 2018-5-31币圈简报

    2018-5-31币圈简报
    一、要闻资讯类I. KEY INFORMATION CATEGORY1、央视:数字货币在京揭牌成立!中国或为此突变!1. View: Digital currency is established in Kyoto! China or mutated for it!中国数字货币来了˂a href="https://mp.weixin.qq.com/s/69fxKCf8GKSCscS4lT8WCA" Target="_blank"rel="noformlow"" Chinese...
标签列表