日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > asp.net >内容正文

asp.net

.NET 7 预览版 2 已发布,NativeAOT 正式可用

發布時間:2023/12/4 asp.net 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 .NET 7 预览版 2 已发布,NativeAOT 正式可用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?.NET 7 Preview 2?已發布,第二個預覽版包括對 RegEx 源生成器的增強、將 NativeAOT 從實驗狀態轉移到運行時的進展,以及對“dotnet new”CLI SDK 的一系列重大改進。

在此下載適用于 Windows、macOS 和 Linux 的?.NET 7 Preview 2 。

引入新的正則表達式源生成器

?新的正則表達式源生成器(Issues?44676)在不增加啟動成本的情況下,為編譯帶來了性能好處,還提供了良好的調試體驗。

要開始使用新的正則表達式源生成器,只需將包含類型轉換為分部(partial)類型,并使用?RegexGenerator?屬性聲明一個新的分部方法。該方法將返回優化的 Regex 對象,源生成器將自動填充該方法的實現,并在更改模式或傳遞其他選項時自動更新。下面是一個例子:

之前:

public class Foo {public Regex regex = new Regex(@"abc|def", RegexOptions.IgnoreCase);public bool Bar(string input){bool isMatch = regex.IsMatch(input);// ..} }

現在:

public partial class Foo // <-- Make the class a partial class {[RegexGenerator(@"abc|def", RegexOptions.IgnoreCase)] // <-- Add the RegexGenerator attribute and pass in your pattern and optionspublic static partial Regex MyRegex(); // <-- Declare the partial method, which will be implemented by the source generatorpublic bool Bar(string input){bool isMatch = MyRegex().IsMatch(input); // <-- Use the generated engine by invoking the partial method.// ..} }

NativeAOT 更新

該版本將 NativeAOT 從實驗性的?dotnet/runtimelab 存儲庫中移出并進入穩定的運行時庫?dotnet/runtime?repo,但尚未在 dotnet SDK 中添加足夠的支持,以使用 NativeAOT 發布項目。

SDK 改進

  • 新的 CLI 解析器 + 選項卡完成??#2191?

.NET 新命令為許多子命令提供了更加一致和直觀的界面,更新了大量對模板選項和參數的 TAB 補全的支持,在用戶輸入有效參數和選項時提供快速反饋。以下是新的幫助輸出示例:

? dotnet new --help Description:Template Instantiation Commands for .NET CLI.Usage:dotnet new [<template-short-name> [<template-args>...]] [options]dotnet new [command] [options]Arguments:<template-short-name> A short name of the template to create.<template-args> Template specific options to use.Options:-?, -h, --help Show command line help.Commands:install <package> Installs a template package.uninstall <package> Uninstalls a template package.update Checks the currently installed template packages for update, and install the updates.search <template-name> Searches for the templates on NuGet.org.list <template-name> Lists templates containing the specified template name. If no name is specified, lists all templates.

新命令名稱

幫助輸出中的所有命令不再具有 -- 前綴,更符合用戶對 CLI 應用程序中子命令的期望。舊版本(--install 等)仍可用于防止破壞用戶腳本,將來會在這些命令中添加過時警告以鼓勵遷移。

Tab 補全

dotnet CLI 在 PowerShell、bash、zsh 和 fish 等流行的 shell 上支持 tab 補全已經有一段時間。然而,實現有意義的補全取決于單獨的 dotnet 命令。對于 .NET 7,新命令學習了如何提供 Tab 補全:

  • 可用的模板名稱(在 dotnet new <template-short-name> 中)

? dotnet new angular angular grpc razor viewstart worker -h blazorserver mstest razorclasslib web wpf /? blazorwasm mvc razorcomponent webapi wpfcustomcontrollib /h classlib nugetconfig react webapp wpflib install console nunit reactredux webconfig wpfusercontrollib list editorconfig nunit-test sln winforms xunit search gitignore page tool-manifest winformscontrollib --help uninstall globaljson proto viewimports winformslib -? update
  • 模板選項(Web 模板中的模板選項列表)

dotnet new web --dry-run --dry-run --language --output -lang --exclude-launch-settings --name --type -n --force --no-https -? -o --framework --no-restore -f /? --help --no-update-check -h /h
  • 模板選項的允許值(選擇模板參數上的選擇值)

dotnet new blazorserver --auth Individual Individual IndividualB2C MultiOrg None SingleOrg Windows

?該預覽版本還有大量其他更新項目,詳情請查看更新公告:https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-preview-2/

總結

以上是生活随笔為你收集整理的.NET 7 预览版 2 已发布,NativeAOT 正式可用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。