{"id":161,"date":"2022-11-10T02:37:27","date_gmt":"2022-11-10T10:37:27","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/?p=161"},"modified":"2022-11-10T02:45:58","modified_gmt":"2022-11-10T10:45:58","slug":"%e5%ae%98%e5%ae%a3-net-7%e7%9a%84-%e5%8f%91%e5%b8%83","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/%e5%ae%98%e5%ae%a3-net-7%e7%9a%84-%e5%8f%91%e5%b8%83\/","title":{"rendered":"\u5b98\u5ba3.NET 7\u7684\u53d1\u5e03"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/Download-NET-7.png\" alt=\"Download .NET 7\" \/><\/p>\n<p><span style=\"font-size: 10pt;\"><strong><em>\u672c\u6587\u7ffb\u8bd1\u4e8eJeremy Likness, Angelos Petropoulos \u548c Jon Douglas\u7684\u8fd9\u7bc7\u82f1\u6587\u6587\u7ae0\uff1a<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-dotnet-7\/\">.NET 7 is Available Today<\/a> \u3002<\/em><\/strong><\/span><\/p>\n<p><a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">\u6b22\u8fce\u4e0b\u8f7d .NET 7\uff01<\/a><\/p>\n<p>.NET 7 \u4e3a<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/welcome-to-csharp-11\">C# 11<\/a> \/ <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-fsharp-7\/\">F# 7<\/a>\u3001<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-maui-dotnet-7\">.NET MAUI<\/a>\u3001<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-asp-net-core-in-dotnet-7\">ASP.NET Core\/Blazor<\/a>\u3001Web API\u3001<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/winforms-enhancements-in-dotnet-7\">WinForms<\/a>\u3001<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wpf-on-dotnet-7\">WPF<\/a>\u7b49\u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u4e86<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/performance_improvements_in_net_7\/\">\u66f4\u9ad8\u7684\u6027\u80fd<\/a>\u548c\u65b0\u529f\u80fd\u3002\u4f7f\u7528 .NET 7\uff0c\u60a8\u8fd8\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06 .NET 7 \u9879\u76ee\u5bb9\u5668\u5316\uff0c\u5728 GitHub \u64cd\u4f5c\u4e2d\u8bbe\u7f6e CI\/CD \u5de5\u4f5c\u6d41\uff0c\u5e76\u5b9e\u73b0cloud-native\u53ef\u89c2\u5bdf\u6027\u3002<\/p>\n<p>\u611f\u8c22 <a href=\"https:\/\/github.com\/dotnet\/aspnetcore\/pull\/43302\">.NET \u5f00\u6e90\u793e\u533a<\/a>\u4e3a\u5851\u9020\u6b64 .NET 7 \u7248\u672c\u505a\u51fa\u7684\u4f17\u591a\u8d21\u732e\u3002\u5728\u6574\u4e2a .NET 7 \u7248\u672c\u4e2d\uff0c<a href=\"https:\/\/dotnet.microsoft.com\/thanks\">\u8d85\u8fc7 8900 \u540d\u8d21\u732e\u8005\u505a\u51fa\u4e86 28k \u8d21\u732e\uff01<\/a><\/p>\n<p>.NET \u4ecd\u7136\u662f\u6700\u5feb\u3001\u6700\u53d7\u559c\u7231\u548c\u6700\u53d7\u4fe1\u4efb\u7684\u5e73\u53f0\u4e4b\u4e00\uff0c\u5b83\u62e5\u6709\u4e00\u4e2a\u5e7f\u6cdb\u7684.NET \u5305\u751f\u6001\u7cfb\u7edf\uff0c\u5176\u4e2d\u5305\u62ec\u8d85\u8fc7 330,000 \u4e2a\u5305\u3002<\/p>\n<p><strong>\u4e0b\u8f7d\u548c\u5347\u7ea7<\/strong><\/p>\n<p>\u60a8\u53ef\u4ee5\u4e0b\u8f7d\u9002\u7528\u4e8e Windows\u3001macOS \u548c Linux\u7684<a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">\u514d\u8d39 .NET 7 \u7248\u672c<\/a>\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">\u5b89\u88c5\u7a0b\u5e8f\u548c\u4e8c\u8fdb\u5236\u6587\u4ef6<\/a><\/li>\n<li><a href=\"https:\/\/mcr.microsoft.com\/catalog?search=dotnet\/\">\u5bb9\u5668\u56fe\u50cf<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/blob\/master\/release-notes\/7.0\/\">Linux \u8f6f\u4ef6\u5305<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/tree\/master\/release-notes\/7.0\">\u53d1\u884c\u8bf4\u660e<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/compatibility\/7.0\">\u91cd\u5927\u53d8\u5316<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/blob\/main\/release-notes\/7.0\/known-issues.md\">\u5df2\u77e5\u7684\u95ee\u9898<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/core\/issues\">GitHub \u95ee\u9898\u8ddf\u8e2a\u5668<\/a><\/li>\n<\/ul>\n<p>\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f<a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/implementations#net-5-and-later-versions\"> .NET Core \u7248\u672c<\/a>\uff0c.NET 7 \u53ef\u4ee5\u8f7b\u677e\u5347\u7ea7\uff0c\u5982\u679c\u60a8\u5f53\u524d\u7ef4\u62a4\u7684\u662f <a href=\"https:\/\/learn.microsoft.com\/dotnet\/fundamentals\/implementations#net-framework\">.NET Framework \u7248\u672c<\/a>\uff0c.NET7\u4e5f\u63d0\u4f9b\u4e86\u51e0\u4e2a\u503c\u5f97\u4fe1\u670d\u7684\u8fc1\u79fb\u7406\u7531\u3002<\/p>\n<p><a href=\"https:\/\/visualstudio.microsoft.com\/downloads\/\">Visual Studio 2022 17.4<\/a> \u73b0\u5728\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e86\u3002 \u5728 Visual Studio 2022 \u4e2d\u5f00\u53d1 .NET 7 \u4e3a\u5f00\u53d1\u4eba\u5458\u63d0\u4f9b\u4e86\u4e00\u6d41\u7684\u751f\u4ea7\u529b\u5de5\u5177\u3002 \u82e5\u8981\u4e86\u89e3 Visual Studio 2022 \u4e2d\u7684\u65b0\u589e\u529f\u80fd\uff0c\u8bf7\u67e5\u770b <a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/visual-studio-2022-17-4\">Visual Studio 2022 \u535a\u5ba2<\/a>\u3002<\/p>\n<p><strong>.NET 7 <\/strong><strong>\u4e2d\u7684\u65b0\u529f\u80fd<\/strong><\/p>\n<p>.NET 7 \u7248\u672c\u4e0e\u5176\u4ed6\u51e0\u4e2a\u4ea7\u54c1\u3001\u5e93\u548c\u5e73\u53f0\u4e00\u8d77\u53d1\u5e03\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-asp-net-core-in-dotnet-7\">NET Core 7<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-ef7\">Entity Framework Core 7<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-maui-dotnet-7\">.NET MAUI<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/winforms-enhancements-in-dotnet-7\">Windows Forms<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wpf-on-dotnet-7\">WPF<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/whats-new-in-orleans-7\/\">Orleans 7<\/a><\/li>\n<\/ul>\n<p>\u5728\u8fd9\u7bc7\u535a\u6587\u4e2d\uff0c\u6211\u4eec\u5c06\u91cd\u70b9\u4ecb\u7ecd .NET \u56e2\u961f\u4e13\u6ce8\u4e8e\u4ea4\u4ed8\u7684\u4e3b\u8981\u4e3b\u9898\uff1a<\/p>\n<ul>\n<li><strong>\u7edf\u4e00<\/strong>\n<ul>\n<li>\u4e00\u4e2a BCL<\/li>\n<li>\u65b0\u7684 TFM<\/li>\n<li>\u5bf9 ARM64 \u7684\u672c\u673a\u652f\u6301<\/li>\n<li>Linux \u4e0a\u589e\u5f3a\u7684 .NET \u652f\u6301<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u73b0\u4ee3\u7684<\/strong>\n<ul>\n<li>\u6301\u7eed\u7684\u6027\u80fd\u6539\u8fdb<\/li>\n<li>\u5f00\u53d1\u4eba\u5458\u751f\u4ea7\u529b\u589e\u5f3a\uff0c\u4f8b\u5982\u5bb9\u5668\u4f18\u5148\u7684\u5de5\u4f5c\u6d41\u7a0b<\/li>\n<li>\u4ece\u76f8\u540c\u7684\u4ee3\u7801\u5e93\u6784\u5efa\u8de8\u5e73\u53f0\u7684\u79fb\u52a8\u548c\u684c\u9762\u5e94\u7528\u7a0b\u5e8f<\/li>\n<\/ul>\n<\/li>\n<li><strong>.NET <\/strong><strong>\u9002\u7528\u4e8e\u4e91\u539f\u751f\u5e94\u7528<\/strong>\n<ul>\n<li>\u6613\u4e8e\u6784\u5efa\u548c\u90e8\u7f72\u5206\u5e03\u5f0f\u4e91\u539f\u751f\u5e94\u7528<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u7b80\u5355\u7684<\/strong>\n<ul>\n<li>\u4f7f\u7528 C# 11 \u7b80\u5316\u548c\u7f16\u5199\u66f4\u5c11\u7684\u4ee3\u7801<\/li>\n<li>\u9488\u5bf9\u4e91\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u7684 HTTP\/3 \u548c\u6700\u5c0f API \u6539\u8fdb<\/li>\n<\/ul>\n<\/li>\n<li><strong>\u6027\u80fd<\/strong>\n<ul>\n<li>\u591a\u9879\u6027\u80fd\u6539\u8fdb<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u4e0b\u9762\uff0c\u6211\u4eec\u5c06\u66f4\u8be6\u7ec6\u5730\u4ecb\u7ecd\u8fd9\u4e9b\u4e3b\u9898\uff0c\u5e76\u5206\u4eab\u66f4\u591a\u5173\u4e8e\u8fd9\u9879\u5de5\u4f5c\u4e3a\u4f55\u5982\u6b64\u91cd\u8981\u7684\u80cc\u666f\u4fe1\u606f\u3002<\/p>\n<p><strong>\u573a\u666f<\/strong><\/p>\n<p>.NET 7 \u7528\u9014\u5e7f\u6cdb\uff0c\u60a8\u53ef\u4ee5\u5728\u4efb\u4f55\u5e73\u53f0\u4e0a\u6784\u5efa\u4efb\u4f55\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u8ba9\u6211\u4eec\u91cd\u70b9\u4ecb\u7ecd\u4ece\u4eca\u5929\u5f00\u59cb\u53ef\u4ee5\u4f7f\u7528 .NET \u5b9e\u73b0\u7684\u4e00\u4e9b\u573a\u666f\uff1a<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/use-net-7-from-any-javascript-app-in-net-7\/\">\u4ece\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\u7684 React \u4ee3\u7801\u8c03\u7528\u73b0\u6709.NET\u5e93<\/a>\uff0c\u901a\u8fc7\u5305\u542b\u7ecf\u8fc7\u4f18\u5316\u4ee5\u5728 WebAssembly \u4e0a\u8fd0\u884c\u7684\u6d41\u7ebf\u578b .NET\u8fd0\u884c\u65f6\u3002<\/li>\n<li>\u4f7f\u7528\u5f3a\u7c7b\u578b C#\u8bbf\u95ee\u5b58\u50a8\u5728 SQL Server \u6570\u636e\u5e93\u4e2d\u7684 <a style=\"background-color: #f7f7f9; font-size: 1rem;\" href=\"https:\/\/learn.microsoft.com\/ef\/core\/what-is-new\/ef-core-7.0\/whatsnew#json-columns\">JSON \u6587\u6863\u7684\u5185\u5bb9<\/a><span style=\"font-size: 1rem;\">\u3002<\/span><\/li>\n<li>\u53ea\u9700\u7f16\u5199\u51e0\u884c\u4ee3\u7801\uff0c\u5373\u53ef<a href=\"https:\/\/learn.microsoft.com\/aspnet\/core\/tutorials\/web-api-help-pages-using-swagger?view=aspnetcore-6.0\">\u5feb\u901f\u6784\u5efa\u548c\u90e8\u7f72\u4f7f\u7528 OpenAPI \u81ea\u52a8\u8bb0\u5f55\u7684\u5b89\u5168 REST \u7aef\u70b9\u3002<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/dotnet\/core\/deploying\/native-aot\/\">\u4f7f\u7528 Ahead of Time (AOT) \u7f16\u8bd1\u4ece C# \u6e90\u4ee3\u7801\u751f\u6210\u7b80\u5316\u7684\u672c\u673a\u5e94\u7528\u7a0b\u5e8f<\/a>\uff0c\u5e76\u76f4\u63a5\u53d1\u5e03\u5230\u5bb9\u5668\u6620\u50cf\u3002<\/li>\n<li>\u8fd0\u884c\u4e00\u4e2a .NET Core \u5e94\u7528\u7a0b\u5e8f\uff0c\u8be5\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u5185\u7f6e API \u5c06\u5185\u5bb9<a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.formats.tar.tarfile?view=net-7.0\">\u538b\u7f29\u5e76\u5b58\u6863\u5230 Linux \u53cb\u597d\u7684\u6587\u4ef6gz\u4e2d<\/a>\u3002<\/li>\n<li>\u4f7f\u7528\u4e3a\u6bcf\u4e2a\u76ee\u6807\u5e73\u53f0\u521b\u5efa\u672c\u673a\u4ee3\u7801\u548c\u7ec4\u4ef6\u7684\u5355\u4e00\u4ee3\u7801\u5e93\u548c\u8bbe\u8ba1\uff0c\u5b9e\u73b0\u60a8\u5bf9 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/maui\/what-is-maui\">Android\u3001iOS \u548c Windows \u4e0a\u7684\u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f<\/a>\u7684\u613f\u666f\u3002<\/li>\n<li>\u901a\u8fc7\u4f7f\u7528<a href=\"https:\/\/dotnet.microsoft.com\/platform\/upgrade-assistant\">\u5347\u7ea7\u52a9\u624b<\/a>\u81ea\u52a8\u8fc1\u79fb\u65e7\u7248\u5e94\u7528\u7a0b\u5e8f\u5e76\u5728 CoreWCF \u7684\u5e2e\u52a9\u4e0b<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/corewcf-v1-released\/\">\u73b0\u4ee3\u5316\u60a8\u7684 Windows Communication Foundation (WCF) Web \u670d\u52a1<\/a>\uff0c\u83b7\u5f97.NET 7 \u7684\u6027\u80fd\u4f18\u52bf\u3002<\/li>\n<li>\u4f7f\u7528\u53cd\u6620\u60a8\u7684\u67b6\u6784\u548c\u8bbe\u8ba1\u9009\u62e9\u7684\u6837\u677f\u6a21\u677f\uff0c\u8ba9\u5f00\u53d1\u4eba\u5458\u6bd4\u4ee5\u5f80\u4efb\u4f55\u65f6\u5019\u90fd\u66f4\u5bb9\u6613\u542f\u52a8\u65b0\u5e94\u7528\u7a0b\u5e8f\u3002<\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/console-readkey-improvements-in-net-7\/\">\u4f7f\u7528ReadKey \u5728 Unix\/Linux \u4e2d\u66f4\u597d\u5730\u5904\u7406\u7ec4\u5408\u952e\u548c\u4fee\u9970\u952e\u3002\u00a0<\/a><\/li>\n<\/ul>\n<p><strong>\u7edf\u4e00<\/strong><\/p>\n<p><strong>\u4e00\u4e2a\u57fa\u7c7b\u5e93<\/strong><strong> (BCL)<\/strong><\/p>\n<p>.NET 7 \u7248\u672c\u662f\u6211\u4eec .NET \u7edf\u4e00\u4e4b\u65c5\u4e2d\u7684\u7b2c\u4e09\u4e2a\u4e3b\u8981\u7248\u672c\uff08\u81ea 2016 \u5e74 .NET 5 \u4ee5\u6765\uff09\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/dotnet-platform2.png\" \/><\/p>\n<p>\u4f7f\u7528 .NET 7\uff0c\u60a8\u53ea\u9700\u5b66\u4e60\u4e00\u6b21\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u4e00\u4e2a SDK\u3001\u4e00\u4e2a\u8fd0\u884c\u65f6\u3001\u4e00\u7ec4\u57fa\u7840\u5e93\u91cd\u590d\u4f7f\u7528\u60a8\u7684\u6280\u80fd\u6765\u6784\u5efa\u591a\u79cd\u7c7b\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\uff08\u4e91\u3001Web\u3001\u684c\u9762\u3001\u79fb\u52a8\u3001\u6e38\u620f\u3001IoT \u548c AI\uff09\u3002<\/p>\n<p><strong>\u9762\u5411<\/strong><strong> .NET 7<\/strong><\/p>\n<p>\u5f53\u60a8\u4ee5\u5e94\u7528\u7a0b\u5e8f\u6216\u5e93\u4e2d\u7684\u6846\u67b6\u4e3a\u76ee\u6807\u65f6\uff0c\u60a8\u6b63\u5728\u6307\u5b9a\u8981\u63d0\u4f9b\u7684 API \u96c6\u3002\u8981\u4ee5 .NET 7 \u4e3a\u76ee\u6807\uff0c\u53ea\u9700\u66f4\u6539\u9879\u76ee\u4e2d\u7684\u76ee\u6807\u6846\u67b6\u5373\u53ef\u3002<\/p>\n<pre class=\"prettyprint\">&lt;TargetFramework&gt;net7.0&lt;\/TargetFramework&gt;<\/pre>\n<p>\u9488\u5bf9 net7.0 Target Framework Moniker (TFM) \u7684\u5e94\u7528\u7a0b\u5e8f\u5c06\u5728\u6240\u6709\u53d7\u652f\u6301\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c CPU \u67b6\u6784\u4e0a\u8fd0\u884c\u3002 \u5b83\u4eec\u4f7f\u60a8\u53ef\u4ee5\u8bbf\u95ee .NET 7 \u4e2d\u7684\u6240\u6709 API \u4ee5\u53ca\u4e00\u5806\u7279\u5b9a\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u7684 API\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>net7.0-android<\/li>\n<li>net7.0-ios<\/li>\n<li>net7.0-maccatalyst<\/li>\n<li>net7.0-macos<\/li>\n<li>net7.0-tvos<\/li>\n<li>net7.0-windows<\/li>\n<\/ul>\n<p>\u901a\u8fc7 <span style=\"color: #ff0000;\">net7.0<\/span> TFM \u516c\u5f00\u7684 API \u65e8\u5728\u968f\u65f6\u968f\u5730\u5de5\u4f5c\u3002 \u5982\u679c\u60a8\u6000\u7591 .NET 7 \u662f\u5426\u652f\u6301 API\uff0c\u60a8\u53ef\u4ee5\u968f\u65f6\u67e5\u770b https:\/\/apisof.net\/\u3002 \u8fd9\u662f\u4e00\u4e2a\u65b0\u6dfb\u52a0\u7684\u63a5\u53e3 <span style=\"color: #ff0000;\">IJsonTypeInfoResolver<\/span> \u7684\u793a\u4f8b\uff0c\u60a8\u53ef\u4ee5\u770b\u5230\u5b83\u73b0\u5728\u5df2\u5185\u7f6e\u5230 .NET 7 \u4e2d\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/API-Of-NET.png\" \/><\/p>\n<p><strong>ARM64<\/strong><\/p>\n<p>\u968f\u7740\u884c\u4e1a\u5411 ARM \u53d1\u5c55\uff0c.NET \u4e5f\u662f\u5982\u6b64\u3002 ARM CPU \u7684\u6700\u5927\u4f18\u52bf\u4e4b\u4e00\u662f\u7535\u6e90\u6548\u7387\u3002\u8fd9\u4ee5\u6700\u4f4e\u7684\u529f\u8017\u5e26\u6765\u6700\u9ad8\u7684\u6027\u80fd\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u60a8\u53ef\u4ee5\u4e8b\u534a\u529f\u500d\u3002\u5728 .NET 5 \u4e2d\uff0c<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/arm64-performance-in-net-5\/\">\u6211\u4eec\u63cf\u8ff0\u4e86\u6211\u4eec\u9488\u5bf9 ARM64 \u6240\u505a\u7684\u6027\u80fd\u8ba1\u5212<\/a>\u3002\u73b0\u5728\uff0c\u5728\u4e24\u4e2a\u7248\u672c\u4e4b\u540e\uff0c\u6211\u4eec\u60f3\u4e0e\u60a8\u5206\u4eab\u6211\u4eec\u5df2\u7ecf\u8d70\u4e86\u591a\u8fdc\u3002\u6211\u4eec\u7684\u6301\u7eed\u76ee\u6807\u662f\u5c06 x64 \u7684\u6027\u80fd\u4e0e ARM64 \u76f8\u5339\u914d\uff0c\u4ee5\u5e2e\u52a9\u6211\u4eec\u7684\u5ba2\u6237\u5c06\u4ed6\u4eec\u7684 .NET \u5e94\u7528\u7a0b\u5e8f\u8fc1\u79fb\u5230 ARM\u3002<\/p>\n<p><strong>\u8fd0\u884c\u65f6\u6539\u8fdb<\/strong><\/p>\n<p>\u6211\u4eec\u5728\u8c03\u67e5 x64 \u548c ARM64 \u65f6\u9047\u5230\u7684\u4e00\u4e2a\u6311\u6218\u662f\u53d1\u73b0\u65e0\u6cd5\u4ece ARM64 \u673a\u5668\u6b63\u786e\u8bfb\u53d6 L3 \u7f13\u5b58\u5927\u5c0f\u3002 \u5f53\u65e0\u6cd5\u4ece\u64cd\u4f5c\u7cfb\u7edf\u6216\u673a\u5668\u7684 BIOS \u4e2d\u83b7\u53d6 L3 \u7f13\u5b58\u5927\u5c0f\uff0c\u6211\u4eec\u901a\u8fc7\u66f4\u6539\u542f\u53d1\u5f0f\u65b9\u6cd5\u4ee5\u8fd4\u56de\u8fd1\u4f3c\u5927\u5c0f\u3002 \u73b0\u5728\u6211\u4eec\u53ef\u4ee5\u66f4\u597d\u5730\u4f30\u8ba1\u6bcf\u4e2a L3 \u7f13\u5b58\u5927\u5c0f\u7684\u5185\u6838\u6570\u3002<\/p>\n<table>\n<thead>\n<tr>\n<td><strong>Core count<\/strong><\/td>\n<td><strong>L3 cache size<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1~4<\/td>\n<td>4MB<\/td>\n<\/tr>\n<tr>\n<td>5~16<\/td>\n<td>8MB<\/td>\n<\/tr>\n<tr>\n<td>17~64<\/td>\n<td>16MB<\/td>\n<\/tr>\n<tr>\n<td>65+<\/td>\n<td>32MB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u63a5\u4e0b\u6765\u662f\u6211\u4eec\u5bf9 LSE \u539f\u5b50\u7684\u7406\u89e3\u3002\u5982\u679c\u60a8\u4e0d\u719f\u6089\uff0c\u5b83\u63d0\u4f9b\u4e86\u539f\u5b50 API \u6765\u83b7\u5f97\u5bf9\u5173\u952e\u533a\u57df\u7684\u72ec\u5360\u8bbf\u95ee\u6743\u9650\u3002\u5728 CISC \u67b6\u6784 x86-x64 \u673a\u5668\u4e2d\uff0c\u5185\u5b58\u4e0a\u7684\u8bfb-\u4fee\u6539-\u5199 (RMW) \u64cd\u4f5c\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u9501\u5b9a\u524d\u7f00\u7684\u5355\u4e2a\u6307\u4ee4\u6267\u884c\u3002<\/p>\n<p>\u4f46\u662f\u5728RISC\u67b6\u6784\u7684\u673a\u5668\u4e0a\uff0cRMW\u64cd\u4f5c\u662f\u4e0d\u5141\u8bb8\u7684\uff0c\u6240\u6709\u7684\u64cd\u4f5c\u90fd\u662f\u901a\u8fc7\u5bc4\u5b58\u5668\u6765\u5b8c\u6210\u7684\u3002 \u56e0\u6b64\uff0c\u5bf9\u4e8e\u5e76\u53d1\u573a\u666f\uff0c\u5b83\u4eec\u6709\u4e00\u5bf9\u6307\u4ee4\u3002 \u201cLoad Acquire\u201d (ldaxr) \u83b7\u5f97\u5bf9\u5185\u5b58\u533a\u57df\u7684\u72ec\u5360\u8bbf\u95ee\u6743\u9650\uff0c\u56e0\u6b64\u5176\u4ed6\u5185\u6838\u65e0\u6cd5\u8bbf\u95ee\u5b83\uff0c\u800c\u201cStore Release\u201d (stlxr) \u5219\u91ca\u653e\u5bf9\u5176\u4ed6\u5185\u6838\u7684\u8bbf\u95ee\u6743\u9650\u3002 \u5728\u8fd9\u4e9b\u5bf9\u4e4b\u95f4\uff0c\u6267\u884c\u5173\u952e\u64cd\u4f5c\u3002 \u5982\u679c\u5728\u4f7f\u7528 ldaxr \u52a0\u8f7d\u5185\u5bb9\u540e\uff0c\u7531\u4e8e\u5176\u4ed6 CPU \u5728\u5185\u5b58\u4e0a\u64cd\u4f5c\u800c\u5bfc\u81f4 stlxr \u64cd\u4f5c\u5931\u8d25\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u4ee3\u7801\u91cd\u8bd5\uff08cbnz jumps back to retry\uff09\u8be5\u64cd\u4f5c\u3002<\/p>\n<p>ARM \u5728 v8.1 \u4e2d\u5f15\u5165\u4e86 LSE \u539f\u5b50\u6307\u4ee4\u3002\u6709\u4e86\u8fd9\u4e9b\u6307\u4ee4\uff0c\u8fd9\u4e9b\u64cd\u4f5c\u53ef\u4ee5\u6bd4\u4f20\u7edf\u7248\u672c\u7528\u66f4\u5c11\u7684\u4ee3\u7801\u548c\u66f4\u5feb\u7684\u901f\u5ea6\u5b8c\u6210\u3002\u5f53\u6211\u4eec\u4e3a Linux \u542f\u7528\u6b64\u529f\u80fd\u5e76\u968f\u540e\u5c06\u5176\u6269\u5c55\u5230 Windows \u65f6\uff0c\u6211\u4eec\u770b\u5230\u4e86\u5927\u7ea6 45% \u7684\u6027\u80fd\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/ARM-Atomics.png\" \/><\/p>\n<p><strong>\u5e93\u6539\u8fdb<\/strong><\/p>\n<p>\u4e3a\u4e86\u4f18\u5316\u4f7f\u7528\u5185\u5728\u51fd\u6570\u7684\u5e93\uff0c\u6211\u4eec\u6dfb\u52a0\u4e86\u65b0\u7684\u8de8\u5e73\u53f0\u52a9\u624b\u3002\u5176\u4e2d\u5305\u62ecVector64\u3001Vector128\u548cVector256 \u7684\u52a9\u624b\u3002\u8de8\u5e73\u53f0\u52a9\u624b\u5141\u8bb8\u901a\u8fc7\u7528\u4e0e\u786c\u4ef6\u65e0\u5173\u7684\u5185\u5728\u51fd\u6570\u66ff\u6362\u7279\u5b9a\u4e8e\u786c\u4ef6\u7684\u5185\u5728\u51fd\u6570\u6765\u7edf\u4e00\u77e2\u91cf\u5316\u7b97\u6cd5\u3002\u8fd9\u5c06\u4f7f\u4efb\u4f55\u5e73\u53f0\u4e0a\u7684\u7528\u6237\u53d7\u76ca\uff0c\u4f46\u6211\u4eec\u9884\u8ba1 ARM64 \u5c06\u53d7\u76ca\u6700\u5927\uff0c\u56e0\u4e3a\u6ca1\u6709 ARM64 \u4e13\u4e1a\u77e5\u8bc6\u7684\u5f00\u53d1\u4eba\u5458\u4ecd\u7136\u80fd\u591f\u4f7f\u7528\u5e2e\u52a9\u7a0b\u5e8f\u6765\u5229\u7528 Arm64 \u786c\u4ef6\u5185\u5728\u51fd\u6570\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/ARM-TextProcessing.png\" \/><\/p>\n<p>\u5c06\u8bf8\u5982 EncodeToUtf8 \u548c DecodeFromUtf8 \u7b49 API \u4ece SSE3 \u5b9e\u73b0\u91cd\u5199\u4e3a\u57fa\u4e8e Vector \u7684 API \u53ef\u4ee5\u63d0\u4f9b\u9ad8\u8fbe 60% \u7684\u6539\u8fdb\u3002<\/p>\n<p>\u8f6c\u6362 <span style=\"color: #ff0000;\">NarrowUtf16ToAscii()<\/span> \u548c <span style=\"color: #ff0000;\">GetIndexOfFirstNonAsciiChar()<\/span> \u7b49\u5176\u4ed6 API \u53ef\u4ee5\u5b9e\u73b0\u9ad8\u8fbe 35% \u7684\u6027\u80fd\u63d0\u5347\u3002<\/p>\n<p><strong>\u6027\u80fd\u5f71\u54cd<\/strong><\/p>\n<p>\u901a\u8fc7\u6211\u4eec\u5728 .NET 7 \u4e2d\u7684\u5de5\u4f5c\uff0c\u8bb8\u591a MicroBenchmark \u63d0\u9ad8\u4e86 10-60%\u3002\u5f53\u6211\u4eec\u5f00\u59cb .NET 7 \u65f6\uff0cARM64 \u7684\u6bcf\u79d2\u8bf7\u6c42\u6570 (RPS) \u8f83\u4f4e\uff0c\u4f46\u6162\u6162\u514b\u670d\u4e86 x64 \u7684\u5947\u5076\u6821\u9a8c\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/ARM-RPS.png\" \/><\/p>\n<p>\u540c\u6837\u5bf9\u4e8e\u5ef6\u8fdf\uff08\u4ee5\u6beb\u79d2\u4e3a\u5355\u4f4d\uff09\uff0c\u6211\u4eec\u5c06\u6865\u63a5 x64 \u7684\u5947\u5076\u6821\u9a8c\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/ARM-Latency.png\" \/><\/p>\n<p>\u6709\u5173\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u67e5\u770b<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/arm64-performance-improvements-in-dotnet-7\/\">.NET 7 \u4e2d\u7684 ARM64 \u6027\u80fd\u6539\u8fdb<\/a>\u3002<\/p>\n<p><strong>Linux <\/strong><strong>\u4e0a\u589e\u5f3a\u7684<\/strong><strong> .NET <\/strong><strong>\u652f\u6301<\/strong><\/p>\n<p>.NET 6 \u5305\u542b\u5728 Ubuntu 22.04 (Jammy) \u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528apt install dotnet6\u547d\u4ee4\u5b89\u88c5\u3002\u6b64\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a\u4f18\u5316\u7684\u3001\u9884\u6784\u5efa\u7684\u3001\u5f00\u7bb1\u5373\u7528\u7684\u8d85\u5c0f\u578b\u5bb9\u5668\u955c\u50cf\u3002<\/p>\n<pre class=\"prettyprint\">dotnetapp % docker run --rm dotnetapp-chiseled\r\n         42\r\n         42              ,d                             ,d\r\n         42              42                             42\r\n ,adPPYb,42  ,adPPYba, MM42MMM 8b,dPPYba,   ,adPPYba, MM42MMM\r\na8\"    `Y42 a8\"     \"8a  42    42P'   `\"8a a8P_____42   42\r\n8b       42 8b       d8  42    42       42 8PP\"\"\"\"\"\"\"   42\r\n\"8a,   ,d42 \"8a,   ,a8\"  42,   42       42 \"8b,   ,aa   42,\r\n `\"8bbdP\"Y8  `\"YbbdP\"'   \"Y428 42       42  `\"Ybbd8\"'   \"Y428\r\n\r\n.NET 7.0.0-preview.7.22375.6\r\nLinux 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022\r\n\r\nOSArchitecture: Arm64\r\nProcessorCount: 4\r\nTotalAvailableMemoryBytes: 3.83 GiB<\/pre>\n<p>\u6709\u5173\u6211\u4eec\u4e0e Canonical \u548c ARM \u5408\u4f5c\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u9605\u8bfb<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-6-is-now-in-ubuntu-2204\"> .NET 6 \u652f\u6301 Ubuntu 22.04 <\/a>\u3002<\/p>\n<p><strong>64 <\/strong><strong>\u4f4d<\/strong><strong> IBM Power <\/strong><strong>\u652f\u6301<\/strong><\/p>\n<p>\u9664\u4e86 x64 \u67b6\u6784\uff0864 \u4f4d Intel\/AMD\uff09\u3001ARM64\uff0864 \u4f4d ARM\uff09\u548c s390x\uff0864 \u4f4d IBM Z\uff09\u4e4b\u5916\uff0c.NET \u73b0\u5728\u4e5f\u53ef\u7528\u4e8e\u9488\u5bf9 RHEL \u7684 ppc64le\uff0864 \u4f4d IBM Power\uff09\u67b6\u67848.7 \u548c RHEL 9.1\u3002<\/p>\n<p>\u8d85\u8fc7 25,000 \u540d IBM Power \u5ba2\u6237\u53ef\u4ee5\u5728 Windows x86 \u4e0a\u6574\u5408\u73b0\u6709\u7684 .NET \u5e94\u7528\u7a0b\u5e8f\uff0c\u4ee5\u4fbf\u5728\u4e0e\u5176 IBM i \u548c AIX \u4e1a\u52a1\u5e94\u7528\u7a0b\u5e8f\u548c\u6570\u636e\u5e93\u76f8\u540c\u7684 Power \u5e73\u53f0\u4e0a\u8fd0\u884c\u3002 \u8fd9\u6837\u505a\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u53ef\u6301\u7eed\u6027\uff0c\u5c06\u78b3\u8db3\u8ff9\u51cf\u5c11\u4e86\u591a\u8fbe 5 \u500d\uff0c\u5e76\u7ed3\u5408\u4e86 RHEL \u548c OpenShift \u5bb9\u91cf\u7684\u672c\u5730\u5373\u7528\u5373\u4ed8\u6269\u5c55\uff0c\u540c\u65f6\u63d0\u4f9b\u884c\u4e1a\u9886\u5148\u7684\u7aef\u5230\u7aef\u4f01\u4e1a\u4e8b\u52a1\u548c\u6570\u636e\u5b89\u5168\u6027\u3002<\/p>\n<p><strong>\u73b0\u4ee3\u7684<\/strong><\/p>\n<p>.NET 7 \u4e13\u4e3a\u73b0\u4ee3\u4e91\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u3001\u79fb\u52a8\u5ba2\u6237\u7aef\u3001\u8fb9\u7f18\u670d\u52a1\u548c\u684c\u9762\u6280\u672f\u800c\u6784\u5efa\u3002 \u4f7f\u7528 .NET MAUI \u5728\u4e0d\u5f71\u54cd\u672c\u673a\u6027\u80fd\u7684\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u5355\u4e2a\u4ee3\u7801\u5e93\u521b\u5efa\u79fb\u52a8\u4f53\u9a8c\u3002 \u4f7f\u7528 C# \u548c Razor \u6a21\u677f\u7b49\u719f\u6089\u7684\u6280\u672f\u6784\u5efa\u54cd\u5e94\u5f0f\u5355\u9875\u5e94\u7528\u7a0b\u5e8f (SPA)\uff0c\u8fd9\u4e9b\u5e94\u7528\u7a0b\u5e8f\u5728\u6d4f\u89c8\u5668\u4e2d\u8fd0\u884c\u5e76\u4f5c\u4e3a\u6e10\u8fdb\u5f0f Web \u5e94\u7528\u7a0b\u5e8f (PWA) \u8131\u673a\u8fd0\u884c\u3002 \u8fd9\u4e9b\u66f4\u5feb\u3001\u66f4\u73b0\u4ee3\u7684\u4f53\u9a8c\u4e0d\u4ec5\u4ec5\u9002\u7528\u4e8e\u65b0\u5e94\u7528\u3002 .NET \u5347\u7ea7\u52a9\u624b\u5c06\u63d0\u4f9b\u6709\u5173\u517c\u5bb9\u6027\u7684\u53cd\u9988\uff0c\u5e76\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5c06\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5b8c\u5168\u8fc1\u79fb\u5230 .NET 6 \u548c .NET 7\u3002<\/p>\n<p><strong>.NET MAUI<\/strong><\/p>\n<p>NET MAUI \u73b0\u5728\u662f .NET 7 \u7684\u4e00\u90e8\u5206\uff0c\u5177\u6709\u5927\u91cf\u6539\u8fdb\u548c\u65b0\u529f\u80fd\u3002\u901a\u8fc7\u9605\u8bfb\u6700\u65b0\u7684<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/dotnet-maui-dotnet-7\">.NET MAUI \u535a\u5ba2\u516c\u544a<\/a>\uff0c\u60a8\u53ef\u4ee5\u4e86\u89e3 .NET MAUI \u4ee5\u53ca\u5b83\u4f7f\u60a8\u80fd\u591f\u4e3a\u6240\u6709\u79fb\u52a8\u8bbe\u5907\u6784\u5efa\u5e94\u7528\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002<\/p>\n<p><strong>Blazor<\/strong><\/p>\n<p>Blazor \u4e0d\u65ad\u53d1\u5c55\uff0c.NET 7 \u5305\u62ec\u8bb8\u591a\u91cd\u5927\u6539\u8fdb\u3002Blazor \u73b0\u5728\u652f\u6301\u5904\u7406\u4f4d\u7f6e\u66f4\u6539\u4e8b\u4ef6\uff0c\u6539\u8fdb\u4e86 WebAssembly \u8c03\u8bd5\u4f53\u9a8c\uff0c\u4ee5\u53ca\u5bf9\u4f7f\u7528 OpenID Connect \u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u7684\u5f00\u7bb1\u5373\u7528\u652f\u6301\u3002\u8981\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u9605\u8bfb\u6700\u65b0\u7684<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/category\/blazor\/\">Blazor \u56e2\u961f\u535a\u5ba2\u6587\u7ae0<\/a>\u3002<\/p>\n<p><strong>\u5347\u7ea7\u52a9\u624b<\/strong><\/p>\n<p>.NET \u5347\u7ea7\u52a9\u624b\u63d0\u4f9b\u5206\u6b65\u6307\u5bfc\u3001\u89c1\u89e3\u548c\u81ea\u52a8\u5316\uff0c\u5c06\u60a8\u7684\u65e7\u5e94\u7528\u7a0b\u5e8f\u8fc1\u79fb\u5230 .NET 6 \u548c .NET 7\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5b83\u53ef\u4ee5\u4e3a\u60a8\u6267\u884c\u8fc1\u79fb\uff01 \u5728\u5bf9\u65e7\u4ee3\u7801\u5e93\u8fdb\u884c\u73b0\u4ee3\u5316\u6539\u9020\u65f6\uff0c\u5b83\u6709\u52a9\u4e8e\u51cf\u5c11\u65f6\u95f4\u548c\u590d\u6742\u6027\u3002 \u4f8b\u5982\uff0c\u4e86\u89e3\u5982\u4f55\u501f\u52a9 CoreWCF \u5c06 WCF \u5e94\u7528\u7a0b\u5e8f\u5f15\u5165 .NET Core\u3002 \u4f7f\u7528 .NET 7\uff0c\u6539\u8fdb\u7684\u4f53\u9a8c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>NET \u5230 ASP.NET Core<\/li>\n<li>Web \u9002\u914d\u5668\uff08\u9884\u89c8\u7248\uff09<\/li>\n<li>\u589e\u91cf\u8fc1\u79fb\uff08\u9884\u89c8\uff09<\/li>\n<li>\u4e3a WinForms\u3001WPF \u548c\u63a7\u5236\u53f0\/\u7c7b\u5e93\u6dfb\u52a0\u4e86\u66f4\u591a\u5206\u6790\u5668\u548c\u4ee3\u7801\u4fee\u590d\u7a0b\u5e8f<\/li>\n<li>\u5206\u6790\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684\u80fd\u529b<\/li>\n<li>UWP \u5230 Windows Appp SDK \u548c WinUI \u652f\u6301<\/li>\n<\/ul>\n<p>\u51c6\u5907\u597d\u5c06\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u8fc1\u79fb\u5230\u8fc4\u4eca\u4e3a\u6b62\u6700\u65b0\u4e14\u6027\u80fd\u6700\u5feb\u7684 .NET \u4e0a\u4e86\u5417\uff1f\u8bf7\u7acb\u5373<a href=\"https:\/\/dotnet.microsoft.com\/platform\/upgrade-assistant\">\u4e0b\u8f7d\u5347\u7ea7\u52a9\u624b<\/a>\uff01<\/p>\n<p><strong>.NET 6 <\/strong><strong>\u8fc1\u79fb\u4eae\u70b9<\/strong><\/p>\n<p>\u5728\u53bb\u5e74\u5ba3\u5e03 .NET 6 \u4e4b\u540e\uff0c\u6709\u8bb8\u591a\u6210\u529f\u7684\u65c5\u7a0b\u5230\u6700\u65b0\u7248\u672c\u7684 .NET\u3002\u8fd9\u4e9b\u6545\u4e8b\u7a81\u51fa\u4e86\u663e\u7740\u6539\u5584 CPU \u4f7f\u7528\u7387\u3001\u589e\u52a0\u6bcf\u79d2\u8bf7\u6c42\u6570 (RPS)\u3001\u66f4\u597d\u5730\u4f7f\u7528\u7ebf\u7a0b\u6c60\u3001\u51cf\u5c11\u4e8c\u8fdb\u5236\u6587\u4ef6\u5927\u5c0f\u3001\u66f4\u5feb\u542f\u52a8\u65f6\u95f4\u3001\u7b80\u5316\u4f9d\u8d56\u9879\u7ba1\u7406\u3001\u964d\u4f4e\u672a\u6765\u6280\u672f\u503a\u52a1\u3001\u964d\u4f4e\u57fa\u7840\u8bbe\u65bd\u6210\u672c\u7684\u597d\u5904\uff0c\u6700\u91cd\u8981\u7684\u662f\uff1a\u5de5\u7a0b\u6ee1\u610f\u5ea6\u548c\u751f\u4ea7\u529b\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/the-azure-cosmos-db-journey-to-net-6\/\">Azure Cosmos DB \u5230 .NET 6 \u7684\u65c5\u7a0b<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/exchange-online-journey-to-net-core\/\">Microsoft Exchange \u5728\u7ebf .NET Core \u4e4b\u65c5<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/one-service-journey-to-dotnet-6\/\">.NET 6 \u7684 OneService \u4e4b\u65c5<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/microsoft-graph-dotnet-6-journey\/\">Microsoft Graph \u7684 .NET 6 \u4e4b\u65c5<\/a><\/li>\n<li><a href=\"https:\/\/dotnet.microsoft.com\/platform\/customers\/microsoft-teams-middletier\">Microsoft Teams \u201cMiddleTier\u201d \u5230 .NET Core<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/microsoft-teams-infrastructure-and-azure-communication-services-journey-to-dotnet-6\/\">Microsoft \u56e2\u961f\u7684\u57fa\u7840\u67b6\u6784\u548c Azure \u901a\u4fe1\u670d\u52a1\u7684 .NET 6 \u4e4b\u65c5<\/a><\/li>\n<li><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/bing-ads-campaign-platform-journey-to-dotnet-6\/\">Bing Ads \u5e7f\u544a\u6d3b\u52a8\u5e73\u53f0 .NET 6 \u4e4b\u65c5<\/a><\/li>\n<li><a href=\"https:\/\/wouterdekort.com\/2022\/05\/25\/the-stackoverflow-journey-to-dotnet6\/\">Stack Overflow \u7684 .NET 6 \u4e4b\u65c5<\/a><\/li>\n<\/ul>\n<p>\u6709\u5173\u4e8e\u8fc1\u79fb\u5230\u6700\u65b0\u7248\u672c .NET \u7684\u6545\u4e8b\u5417\uff1f\u8bf7\u5728\u4e0b\u9762\u7684\u8bc4\u8bba\u4e2d\u544a\u8bc9\u6211\u4eec\u3002<\/p>\n<p><strong>.NET <\/strong><strong>\u9002\u7528\u4e8e\u4e91\u539f\u751f\u5e94\u7528<\/strong><\/p>\n<p>.NET 7 \u4f7f\u5f00\u7bb1\u5373\u7528\u5730\u6784\u5efa\u4e91\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\u53d8\u5f97\u524d\u6240\u672a\u6709\u7684\u5bb9\u6613\u3002\u4f7f\u7528 Visual Studio \u7684\u8fde\u63a5\u670d\u52a1\u5b89\u5168\u5730\u8fde\u63a5\u5230\u6570\u636e\u670d\u52a1\u5e76\u5b89\u5168\u5730\u52a0\u5bc6\u7528\u6237\u673a\u5bc6\u6587\u4ef6\u6216 Azure Key Vault \u4e2d\u7684\u8fde\u63a5\u5b57\u7b26\u4e32\u3002\u5c06\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u76f4\u63a5\u6784\u5efa\u5230\u5bb9\u5668\u6620\u50cf\u4e2d\u3002\u4f7f\u7528 Entity Framework 7 \u7f16\u5199\u5f3a\u7c7b\u578b\u8bed\u8a00\u96c6\u6210\u67e5\u8be2 (LINQ) \u67e5\u8be2\uff0c\u8fd9\u4e9b\u67e5\u8be2\u4f7f\u7528 SQL Server \u7684 JSON \u652f\u6301\u4ece\u5b58\u50a8\u5728\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\u7684 JSON \u6587\u6863\u4e2d\u5feb\u901f\u63d0\u53d6\u5185\u5bb9\u3002\u53ea\u9700\u51e0\u884c\u4ee3\u7801\uff0c\u5373\u53ef\u901a\u8fc7\u7ecf\u8fc7\u8eab\u4efd\u9a8c\u8bc1\u7684\u7aef\u70b9\u4ea4\u4ed8\u5b89\u5168\u7684 JSON \u6587\u6863\uff0c\u5e76\u63d0\u4f9b\u6700\u5c11\u7684 API \u4f53\u9a8c\u3002\u4f7f\u7528 Open Telemetry \u6536\u96c6\u6709\u5173\u60a8\u6b63\u5728\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u7684\u89c1\u89e3\u3002<\/p>\n<p><strong>Azure <\/strong><strong>\u652f\u6301<\/strong><\/p>\n<p>.NET 7 \u4e0d\u4ec5\u975e\u5e38\u9002\u5408\u6784\u5efa\u4e91\u539f\u751f\u5e94\u7528\u7a0b\u5e8f\uff1b Azure \u7684 PaaS \u670d\u52a1\uff0c\u4f8b\u5982\u9002\u7528\u4e8e Windows \u548c Linux \u7684\u5e94\u7528\u670d\u52a1\u3001Static Web \u5e94\u7528\u3001Azure Functions \u548c Azure \u5bb9\u5668\u5e94\u7528\uff0c<a href=\"https:\/\/go.microsoft.com\/fwlink\/?linkid=2214434\">\u5df2\u7ecf\u90fd\u652f\u6301.NET 7\u4e86<\/a> \u5c31\u50cf\u4e4b\u524d\u7684 \u00a0.NET 5.0 \u548c 6.0\u4e00\u6837\u3002 \u5728\u53d1\u5e03\u7684\u7b2c\u4e00\u5468\uff0c\u60a8\u53ef\u80fd\u4f1a\u9047\u5230 .NET 7 \u5e94\u7528\u7a0b\u5e8f\u7684\u542f\u52a8\u65f6\u95f4\u7a0d\u957f\u4e00\u4e9b\uff0c\u56e0\u4e3a .NET 7 SDK \u5c06\u53ca\u65f6\u5b89\u88c5\uff0c\u4ee5\u4fbf\u5ba2\u6237\u4f7f\u7528 .NET 7 \u521b\u5efa\u65b0\u7684\u5e94\u7528\u7a0b\u5e8f\u670d\u52a1\u3002\u6b64\u5916\uff0c\u5982\u679c\u60a8\u6b63\u5728\u8fd0\u884c .NET 7 \u9884\u89c8\u7248\uff0c\u53ea\u9700\u91cd\u65b0\u542f\u52a8\u5e94\u7528\u670d\u52a1\u5373\u53ef\u5c06\u60a8\u66f4\u65b0\u5230 GA\u3002<\/p>\n<p><strong>\u5185\u7f6e\u5bb9\u5668\u652f\u6301<\/strong><\/p>\n<p>\u5bb9\u5668\u7684\u666e\u53ca\u548c\u5b9e\u9645\u4f7f\u7528\u6b63\u5728\u4e0a\u5347\uff0c\u5bf9\u4e8e\u8bb8\u591a\u516c\u53f8\u6765\u8bf4\uff0c\u5b83\u4eec\u4ee3\u8868\u4e86\u90e8\u7f72\u5230\u4e91\u7684\u9996\u9009\u65b9\u5f0f\u3002\u4f46\u662f\uff0c\u4f7f\u7528\u5bb9\u5668\u4f1a\u4e3a\u56e2\u961f\u7684\u79ef\u538b\u5de5\u4f5c\u589e\u52a0\u65b0\u7684\u5de5\u4f5c\uff0c\u5305\u62ec\u6784\u5efa\u548c\u53d1\u5e03\u955c\u50cf\u3001\u68c0\u67e5\u5b89\u5168\u6027\u548c\u5408\u89c4\u6027\u4ee5\u53ca\u4f18\u5316\u955c\u50cf\u7684\u6027\u80fd\u3002\u6211\u4eec\u76f8\u4fe1\u6709\u673a\u4f1a\u4f7f\u7528 .NET \u5bb9\u5668\u521b\u5efa\u66f4\u597d\u3001\u66f4\u7b80\u5316\u7684\u4f53\u9a8c\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u60a8\u53ea\u9700\u4f7f\u7528 <span style=\"color: #ff0000;\">dotnet publish<\/span> \u5373\u53ef\u521b\u5efa\u5e94\u7528\u7a0b\u5e8f\u7684\u5bb9\u5668\u5316\u7248\u672c\u3002 \u6211\u4eec\u6784\u5efa\u6b64\u89e3\u51b3\u65b9\u6848\u7684\u76ee\u6807\u662f\u4e0e\u73b0\u6709\u6784\u5efa\u903b\u8f91\u65e0\u7f1d\u96c6\u6210\uff0c\u5229\u7528\u6211\u4eec\u81ea\u5df1\u4e30\u5bcc\u7684 C# \u5de5\u5177\u548c\u8fd0\u884c\u65f6\u6027\u80fd\uff0c\u5e76\u76f4\u63a5\u5185\u7f6e\u5230 .NET SDK \u7684\u76d2\u5b50\u4e2d\u4ee5\u8fdb\u884c\u5b9a\u671f\u66f4\u65b0\u3002<\/p>\n<p>\u5bb9\u5668\u56fe\u50cf\u73b0\u5728\u662f .NET SDK \u652f\u6301\u7684\u8f93\u51fa\u7c7b\u578b\uff1a<\/p>\n<pre class=\"prettyprint\"># create a new project and move to its directory\r\ndotnet new mvc -n my-awesome-container-app\r\ncd my-awesome-container-app\r\n\r\n# add a reference to a (temporary) package that creates the container\r\ndotnet add package Microsoft.NET.Build.Containers\r\n\r\n# publish your project for linux-x64\r\ndotnet publish --os linux --arch x64 -p:PublishProfile=DefaultContainer<\/pre>\n<p>\u8981\u4e86\u89e3\u6709\u5173\u5185\u7f6e\u5bb9\u5668\u652f\u6301\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-builtin-container-support-for-the-dotnet-sdk\/\">\u5b98\u5ba3\u5bf9 .NET SDK \u7684\u5185\u7f6e\u5bb9\u5668\u652f\u6301<\/a>\u3002<\/p>\n<p><strong>Microsoft Orleans<\/strong><\/p>\n<p>Microsoft Orleans 7.0 \u5c06\u4f7f\u7528\u201cplain old CLR object\u201d(POCO) Grains \u63d0\u4f9b\u66f4\u7b80\u5355\u7684\u7f16\u7a0b\u6a21\u578b\uff0c\u63d0\u4f9b\u6bd4 3.x \u9ad8 150% \u7684\u6027\u80fd\uff0c\u5e76\u5f15\u5165\u65b0\u7684\u5e8f\u5217\u5316\u548c\u4e0d\u53d8\u6027\u6539\u8fdb\u3002 ASP.NET Core \u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u4f7f\u7528 Orleans \u7b80\u5355\u5730\u6dfb\u52a0\u5206\u5e03\u5f0f\u72b6\u6001\uff0c\u5e76\u786e\u4fe1\u4ed6\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u5c06\u5728\u4e0d\u589e\u52a0\u590d\u6742\u6027\u7684\u60c5\u51b5\u4e0b\u6c34\u5e73\u6269\u5c55\u3002 \u6211\u4eec\u5c06\u7ee7\u7eed\u6295\u8d44\u4ee5\u4f7f Orleans \u529f\u80fd\u66f4\u63a5\u8fd1 ASP.NET \u5806\u6808\uff0c\u4ee5\u786e\u4fdd\u60a8\u7684 Web \u548c API \u5e94\u7528\u7a0b\u5e8f\u4e3a\u4e91\u89c4\u6a21\u3001\u5206\u5e03\u5f0f\u6258\u7ba1\u65b9\u6848\u751a\u81f3\u591a\u4e91\u90e8\u7f72\u505a\u597d\u51c6\u5907\u3002 Orleans \u652f\u6301\u5927\u591a\u6570\u6d41\u884c\u7684\u5b58\u50a8\u673a\u5236\u548c\u6570\u636e\u5e93\uff0c\u5e76\u4e14\u80fd\u591f\u5728 ASP.NET Core \u53ef\u4ee5\u8fd0\u884c\u7684\u4efb\u4f55\u5730\u65b9\u8fd0\u884c\uff0cOrleans \u662f\u8ba9\u60a8\u7684 .NET \u5e94\u7528\u7a0b\u5e8f\u5177\u6709\u4e91\u539f\u751f\u5206\u5e03\u5f0f\u529f\u80fd\u7684\u7edd\u4f73\u9009\u62e9\uff0c\u800c\u65e0\u9700\u5b66\u4e60\u65b0\u7684\u6846\u67b6\u6216\u5de5\u5177\u96c6\u3002 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/whats-new-in-orleans-7\/\">\u4e86\u89e3\u6709\u5173Orleans 7 \u7684\u66f4\u591a\u4fe1\u606f<\/a>\u3002<\/p>\n<p><strong>\u53ef\u89c2\u5bdf\u6027<\/strong><\/p>\n<p>\u53ef\u89c2\u5bdf\u6027\u7684\u76ee\u6807\u662f\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u4e86\u89e3\u5e94\u7528\u7a0b\u5e8f\u5728\u6269\u5c55\u548c\u6280\u672f\u590d\u6742\u6027\u589e\u52a0\u65f6\u7684\u72b6\u6001\u3002 .NET \u63a5\u53d7\u4e86 <a href=\"https:\/\/opentelemetry.io\/\">OpenTelemetry<\/a>\uff0c\u540c\u65f6\u8fd8\u5728 .NET 7 \u4e2d\u8fdb\u884c\u4e86\u4ee5\u4e0b\u6539\u8fdb\u3002<\/p>\n<p><strong>\u4ecb\u7ecd<\/strong><strong> Activity.Current <\/strong><strong>\u66f4\u6539\u4e8b\u4ef6<\/strong><\/p>\n<p>\u5206\u5e03\u5f0f\u8ddf\u8e2a\u7684\u5178\u578b\u5b9e\u73b0\u4f7f\u7528 <span style=\"color: #ff0000;\">AsyncLocal&lt;T&gt;<\/span> \u6765\u8ddf\u8e2a\u6258\u7ba1\u7ebf\u7a0b\u7684\u201c\u8de8\u5ea6\u4e0a\u4e0b\u6587\u201d\u3002 \u901a\u8fc7\u4f7f\u7528\u91c7\u7528 <span style=\"color: #ff0000;\">valueChangedHandler<\/span> \u53c2\u6570\u7684 AsyncLocal&lt;T&gt; \u6784\u9020\u51fd\u6570\u6765\u8ddf\u8e2a\u8de8\u5ea6\u4e0a\u4e0b\u6587\u7684\u66f4\u6539\u3002 \u4f46\u662f\uff0c\u968f\u7740 <span style=\"color: #ff0000;\">Activity<\/span> \u6210\u4e3a\u4ee3\u8868spans \u7684\u6807\u51c6\u88abOpenTelemetry \u6240\u4f7f\u7528\uff0c\u56e0\u6b64\u4e0d\u53ef\u80fd\u8bbe\u7f6e\u503c\u66f4\u6539\u5904\u7406\u7a0b\u5e8f\uff0c\u4f46\u662f \u4e0a\u4e0b\u6587\u53ef\u4ee5\u901a\u8fc7<span style=\"color: #ff0000;\">Activity.Current<\/span> \u6765\u8ddf\u8e2a\u3002 \u53ef\u4ee5\u4f7f\u7528\u65b0\u7684\u66f4\u6539\u4e8b\u4ef6\u6765\u63a5\u6536\u6240\u9700\u7684\u901a\u77e5\u3002<\/p>\n<pre class=\"prettyprint\">Activity.CurrentChanged += CurrentChanged;\r\n\r\nvoid CurrentChanged(object? sender, ActivityChangedEventArgs e)\r\n{\r\n  Console.WriteLine($\"Activity.Current value changed from Activity:  {e.Previous.OperationName} to Activity: {e.Current.OperationName}\");\r\n}<\/pre>\n<p><strong>\u516c\u5f00\u9ad8\u6027\u80fd\u6d3b\u52a8\u5c5e\u6027\u679a\u4e3e\u5668\u65b9\u6cd5<\/strong><\/p>\n<p>\u4ee5\u4e0b\u65b0\u516c\u5f00\u7684\u65b9\u6cd5\u53ef\u4ee5\u5728\u6027\u80fd\u5173\u952e\u573a\u666f\u4e2d\u7528\u4e8e\u679a\u4e3e Activity \u7684\u6807\u7b7e\u3001\u94fe\u63a5\u548c\u4e8b\u4ef6\u5c5e\u6027\uff0c\u800c\u65e0\u9700\u4efb\u4f55\u989d\u5916\u7684\u5206\u914d\u548c\u9ad8\u6027\u80fd\u9879\u8bbf\u95ee\uff1a<\/p>\n<pre class=\"prettyprint\">Activity a = new Activity(\"Root\");\r\n\r\na.SetTag(\"key1\", \"value1\");\r\na.SetTag(\"key2\", \"value2\");\r\n\r\nforeach (ref readonly KeyValuePair&lt;string, object?&gt; tag in a.EnumerateTagObjects())\r\n{\r\n  Console.WriteLine($\"{tag.Key}, {tag. Value}\");<\/pre>\n<p><strong>\u516c\u5f00\u9ad8\u6027\u80fd<\/strong><strong> ActivityEvent <\/strong><strong>\u548c<\/strong><strong> ActivityLink <\/strong><strong>\u6807\u7b7e\u679a\u4e3e\u5668\u65b9\u6cd5<\/strong><\/p>\n<p>\u4e0e\u4e0a\u8ff0\u7c7b\u4f3c\uff0cActivityEvent \u548c ActivityLink Tag \u5bf9\u8c61\u4e5f\u88ab\u516c\u5f00\uff0c\u4ee5\u51cf\u5c11\u5bf9\u9ad8\u6027\u80fd\u9879\u76ee\u8bbf\u95ee\u7684\u4efb\u4f55\u989d\u5916\u5206\u914d\uff1a<\/p>\n<pre class=\"prettyprint\">var tags = new List&lt;KeyValuePair&lt;string, object?&gt;&gt;()\r\n{\r\n  new KeyValuePair&lt;string, object?&gt;(\"tag1\", \"value1\"),\r\n  new KeyValuePair&lt;string, object?&gt;(\"tag2\", \"value2\"),\r\n};\r\n\r\nActivityLink link = new ActivityLink(default, new ActivityTagsCollection(tags));\r\n\r\nforeach (ref readonly KeyValuePair&lt;string, object?&gt; tag in link.EnumerateTagObjects())\r\n{\r\n\/\/ Consume the link tags without any extra allocations or value copying.\r\n}\r\n\r\nActivityEvent e = new ActivityEvent(\"SomeEvent\", tags: new ActivityTagsCollection(tags));\r\n\r\nforeach (ref readonly KeyValuePair&lt;string, object?&gt; tag in e.EnumerateTagObjects())\r\n{\r\n\/\/ Consume the event's tags without any extra allocations or value copying.\r\n}<\/pre>\n<p><strong>Simple<\/strong><\/p>\n<p><strong>C# 11 &amp; F# 7<\/strong><\/p>\n<p>C# \u548c F# \u8bed\u8a00\u7684\u6700\u65b0\u6210\u5458\u662f <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/welcome-to-csharp-11\">C# 11<\/a> \u548c <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/announcing-fsharp-7\/\">F# 7<\/a>\u3002C# 11 \u4f7f\u901a\u7528\u6570\u5b66\u7b49\u65b0\u529f\u80fd\u6210\u4e3a\u53ef\u80fd\uff0c\u540c\u65f6\u901a\u8fc7\u5bf9\u8c61\u521d\u59cb\u5316\u6539\u8fdb\u3001\u539f\u59cb\u5b57\u7b26\u4e32\u6587\u5b57\u7b49\u7b80\u5316\u4e86\u4ee3\u7801\u3002<\/p>\n<p><strong>\u901a\u7528\u6570\u5b66<\/strong><\/p>\n<p>.NET 7 \u4e3a\u57fa\u7c7b\u5e93\u5f15\u5165\u4e86\u65b0\u7684\u6570\u5b66\u76f8\u5173\u901a\u7528\u63a5\u53e3\u3002 \u8fd9\u4e9b\u63a5\u53e3\u7684\u53ef\u7528\u6027\u610f\u5473\u7740\u60a8\u53ef\u4ee5\u5c06\u6cdb\u578b\u7c7b\u578b\u6216\u65b9\u6cd5\u7684\u7c7b\u578b\u53c2\u6570\u7ea6\u675f\u4e3a\u201c\u7c7b\u4f3c\u6570\u5b57\u201d\u3002 \u6b64\u5916\uff0cC# 11 \u53ca\u66f4\u9ad8\u7248\u672c\u5141\u8bb8\u60a8\u5b9a\u4e49\u9759\u6001\u865a\u62df\u63a5\u53e3\u6210\u5458\u3002 \u56e0\u4e3a\u8fd0\u7b97\u7b26\u5fc5\u987b\u58f0\u660e\u4e3a\u9759\u6001\uff0c\u6240\u4ee5\u8fd9\u4e2a\u65b0\u7684 C# \u529f\u80fd\u5141\u8bb8\u5728\u65b0\u63a5\u53e3\u4e2d\u4e3a\u7c7b\u4f3c\u6570\u5b57\u7684\u7c7b\u578b\u58f0\u660e\u8fd0\u7b97\u7b26\u3002<\/p>\n<p>\u603b\u4e4b\uff0c\u8fd9\u4e9b\u521b\u65b0\u8ba9\u60a8\u53ef\u4ee5\u901a\u7528\u5730\u6267\u884c\u6570\u5b66\u8fd0\u7b97\u2014\u2014\u4e5f\u5c31\u662f\u8bf4\uff0c\u65e0\u9700\u77e5\u9053\u60a8\u6b63\u5728\u4f7f\u7528\u7684\u786e\u5207\u7c7b\u578b\u3002 \u4f8b\u5982\uff0c\u5982\u679c\u60a8\u60f3\u7f16\u5199\u4e00\u4e2a\u5c06\u4e24\u4e2a\u6570\u5b57\u76f8\u52a0\u7684\u65b9\u6cd5\uff0c\u4e4b\u524d\u60a8\u5fc5\u987b\u4e3a\u6bcf\u79cd\u7c7b\u578b\u6dfb\u52a0\u65b9\u6cd5\u7684\u91cd\u8f7d\uff08\u4f8b\u5982\uff0c<span style=\"color: #ff0000;\">static int Add(int first, int second<\/span>) \u548c <span style=\"color: #ff0000;\">static float Add(float first, float second)<\/span>. \u73b0\u5728\u60a8\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u5355\u4e00\u7684\u6cdb\u578b\u65b9\u6cd5\uff0c\u5176\u4e2d\u7c7b\u578b\u53c2\u6570\u88ab\u9650\u5236\u4e3a\u7c7b\u4f3c\u6570\u5b57\u7684\u7c7b\u578b\u3002<\/p>\n<pre class=\"prettyprint\">static T Add&lt;T&gt;(T left, T right) where T : INumber&lt;T&gt;\r\n{\r\n    return left + right;\r\n}<\/pre>\n<p>\u5728\u6b64\u65b9\u6cd5\u4e2d\uff0c\u7c7b\u578b\u53c2\u6570 T \u88ab\u7ea6\u675f\u4e3a\u5b9e\u73b0\u65b0<span style=\"color: #ff0000;\"> INumber&lt;TSelf&gt;<\/span> \u63a5\u53e3\u7684\u7c7b\u578b\u3002<span style=\"color: #ff0000;\"> INumber&lt;TSelf&gt;<\/span> \u5b9e\u73b0\u4e86 <span style=\"color: #ff0000;\">IAdditionOperators&lt;TSelf,TOther,TResult&gt;<\/span> \u63a5\u53e3\uff0c\u5176\u4e2d\u5305\u542b + \u8fd0\u7b97\u7b26\u3002 \u8fd9\u901a\u5e38\u5141\u8bb8\u8be5\u65b9\u6cd5\u6dfb\u52a0\u4e24\u4e2a\u6570\u5b57\u3002 \u6b64\u65b9\u6cd5\u53ef\u7528\u4e8e .NET \u7684\u4efb\u4f55\u5185\u7f6e\u6570\u5b57\u7c7b\u578b\uff0c\u56e0\u4e3a\u5b83\u4eec\u90fd\u5df2\u66f4\u65b0\u4e3a\u5728 .NET 7 \u4e2d\u5b9e\u73b0 INumber&lt;TSelf&gt;\u3002<\/p>\n<p>\u5e93\u4f5c\u8005\u5c06\u4ece\u901a\u7528\u6570\u5b66\u63a5\u53e3\u4e2d\u53d7\u76ca\u6700\u591a\uff0c\u56e0\u4e3a\u4ed6\u4eec\u53ef\u4ee5\u901a\u8fc7\u5220\u9664\u201c\u5197\u4f59\u201d\u91cd\u8f7d\u6765\u7b80\u5316\u4ed6\u4eec\u7684\u4ee3\u7801\u5e93\u3002 \u5176\u4ed6\u5f00\u53d1\u4eba\u5458\u5c06\u95f4\u63a5\u53d7\u76ca\uff0c\u56e0\u4e3a\u4ed6\u4eec\u4f7f\u7528\u7684 API \u53ef\u80fd\u4f1a\u5f00\u59cb\u652f\u6301\u66f4\u591a\u7c7b\u578b\u3002<\/p>\n<p>\u67e5\u770b\u6709\u5173<a href=\"https:\/\/learn.microsoft.com\/dotnet\/standard\/generics\/math\">\u901a\u7528\u6570\u5b66\u7684\u6587\u6863<\/a>\uff0c\u4e86\u89e3\u6709\u5173\u6bcf\u4e2a\u63a5\u53e3\u516c\u5f00\u7684\u6838\u5fc3 API \u7684\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<p><strong>\u539f\u59cb\u5b57\u7b26\u4e32\u6587\u5b57<\/strong><\/p>\n<p>\u73b0\u5728\u6709\u4e00\u79cd\u65b0\u7684\u5b57\u7b26\u4e32\u6587\u5b57\u683c\u5f0f\u3002 \u539f\u59cb\u5b57\u7b26\u4e32\u6587\u5b57\u53ef\u4ee5\u5305\u542b\u4efb\u610f\u6587\u672c\uff0c\u5305\u62ec\u7a7a\u683c\u3001\u6362\u884c\u7b26\u3001\u5d4c\u5165\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\uff0c\u800c\u65e0\u9700\u8f6c\u4e49\u5e8f\u5217\u3002 \u539f\u59cb\u5b57\u7b26\u4e32\u6587\u5b57\u81f3\u5c11\u4ee5\u4e09\u4e2a\u53cc\u5f15\u53f7 (&#8220;&#8221;&#8221;) \u5b57\u7b26\u5f00\u5934\uff0c\u5e76\u4ee5\u76f8\u540c\u6570\u91cf\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\u7ed3\u5c3e\u3002<\/p>\n<pre class=\"prettyprint\">string longMessage = \"\"\"\r\n    This is a long message.\r\n    It has several lines.\r\n        Some are indented\r\n                more than others.\r\n    Some should start at the first column.\r\n    Some have \"quoted text\" in them.\r\n    \"\"\";<\/pre>\n<p><strong>.NET <\/strong><strong>\u5e93<\/strong><\/p>\n<p>\u8bb8\u591a .NET \u7684\u7b2c\u4e00\u65b9\u5e93\u5728 .NET 7 \u7248\u672c\u4e2d\u5f97\u5230\u4e86\u663e\u7740\u6539\u8fdb\u3002 \u60a8\u5c06\u770b\u5230\u5bf9 Microsoft.Extensions.* \u5305\u7684\u53ef\u4e3a\u7a7a\u6ce8\u91ca\u7684\u652f\u6301\u3001System.Text.Json \u7684\u5408\u540c\u81ea\u5b9a\u4e49\u548c\u7c7b\u578b\u5c42\u6b21\u7ed3\u6784\uff0c\u4ee5\u53ca\u5e2e\u52a9\u60a8\u4ee5\u78c1\u5e26\u5b58\u6863 (TAR) \u683c\u5f0f\u7f16\u5199\u6570\u636e\u7684\u65b0 Tar API \u7b49\u7b49\u3002<\/p>\n<p><strong>Microsoft.Extensions <\/strong><strong>\u7684\u53ef\u7a7a\u6ce8\u91ca<\/strong><\/p>\n<p>\u6240\u6709 Microsoft.Extensions.* \u5e93\u73b0\u5728\u90fd\u5305\u542b C# 8 \u9009\u62e9\u52a0\u5165\u529f\u80fd\uff0c\u8be5\u529f\u80fd\u5141\u8bb8\u7f16\u8bd1\u5668\u8ddf\u8e2a\u5f15\u7528\u7c7b\u578b\u53ef\u7a7a\u6027\u4ee5\u6355\u83b7\u6f5c\u5728\u7684\u7a7a\u53d6\u6d88\u5f15\u7528\u3002 \u8fd9\u6709\u52a9\u4e8e\u60a8\u5c06\u4ee3\u7801\u5bfc\u81f4\u8fd0\u884c\u65f6\u629b\u51fa System.NullReferenceException \u7684\u53ef\u80fd\u6027\u964d\u81f3\u6700\u4f4e\u3002<\/p>\n<p><strong>System.Composition.Hosting<\/strong><\/p>\n<p>\u6dfb\u52a0\u4e86\u4e00\u4e2a\u65b0 API \u4ee5\u5141\u8bb8 <span style=\"color: #ff0000;\">System.Composition.Hosting<\/span> \u5bb9\u5668\u4e2d\u7684\u5355\u4e2a\u5bf9\u8c61\u5b9e\u4f8b\u901a\u8fc7 API <span style=\"color: #ff0000;\">ComposeExportedValue(CompositionContainer, T)<\/span> \u63d0\u4f9b\u4e0e <span style=\"color: #ff0000;\">System.ComponentModel.Composition.Hosting<\/span> \u7684\u65e7\u63a5\u53e3\u7c7b\u4f3c\u7684\u529f\u80fd\u3002<\/p>\n<pre class=\"prettyprint\">namespace System.Composition.Hosting\r\n{\r\n  public class ContainerConfiguration\r\n  {\r\n      public ContainerConfiguration WithExport&lt;TExport&gt;(TExport exportedInstance);\r\n      public ContainerConfiguration WithExport&lt;TExport&gt;(TExport exportedInstance, string contractName = null, IDictionary&lt;string, object&gt; metadata = null);\r\n      public ContainerConfiguration WithExport(Type contractType, object exportedInstance);\r\n      public ContainerConfiguration WithExport(Type contractType, object exportedInstance, string contractName = null, IDictionary&lt;string, object&gt; metadata = null);\r\n  }\r\n}<\/pre>\n<p><strong>\u5c06\u5fae\u79d2\u548c\u7eb3\u79d2\u6dfb\u52a0\u5230<\/strong><strong> TimeStamp<\/strong><strong>\u3001<\/strong><strong>DateTime<\/strong><strong>\u3001<\/strong><strong>DateTimeOffset <\/strong><strong>\u548c<\/strong><strong> TimeOnly<\/strong><\/p>\n<p>\u5728 .NET 7 \u4e4b\u524d\uff0c\u5404\u79cd\u65e5\u671f\u548c\u65f6\u95f4\u7ed3\u6784\u4e2d\u53ef\u7528\u7684\u6700\u5c0f\u65f6\u95f4\u589e\u91cf\u662f Ticks \u5c5e\u6027\u4e2d\u7684\u201ctick\u201d\u3002 \u4f5c\u4e3a\u53c2\u8003\uff0c\u4e00\u4e2atick\u662f 100ns\u3002 \u4f20\u7edf\u4e0a\uff0c\u5f00\u53d1\u4eba\u5458\u5fc5\u987b\u5bf9\u201ctick\u201d\u503c\u6267\u884c\u8ba1\u7b97\u4ee5\u786e\u5b9a\u5fae\u79d2\u548c\u7eb3\u79d2\u503c\u3002 \u5728 .NET 7 \u4e2d\uff0c\u6211\u4eec\u5728\u65e5\u671f\u548c\u65f6\u95f4\u5b9e\u73b0\u4e2d\u5f15\u5165\u4e86\u5fae\u79d2\u548c\u7eb3\u79d2\uff1a<\/p>\n<pre class=\"prettyprint\">namespace System\r\n{\r\n  public struct DateTime\r\n  {\r\n    public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond);\r\n    public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, System.DateTimeKind kind);\r\n    public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, System.Globalization.Calendar calendar);\r\n    public int Microsecond { get; }\r\n    public int Nanosecond { get; }\r\n    public DateTime AddMicroseconds(double value);\r\n  }\r\n\r\n  public struct DateTimeOffset\r\n  {\r\n    public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, System.TimeSpan offset);\r\n    public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, System.TimeSpan offset, System.Globalization.Calendar calendar);\r\n    public int Microsecond { get; }\r\n    public int Nanosecond { get; }\r\n    public DateTimeOffset AddMicroseconds(double microseconds);\r\n  }\r\n\r\n  public struct TimeSpan\r\n  {\r\n    public const long TicksPerMicrosecond = 10L;\r\n    public const long NanosecondsPerTick = 100L;\r\n    public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds, int microseconds);\r\n    public int Microseconds { get; }\r\n    public int Nanoseconds { get; }\r\n    public double TotalMicroseconds { get; }\r\n    public double TotalNanoseconds { get; }\r\n    public static TimeSpan FromMicroseconds(double microseconds);\r\n  }\r\n\r\n  public struct TimeOnly\r\n  {\r\n    public TimeOnly(int hour, int minute, int second, int millisecond, int microsecond);\r\n    public int Microsecond { get; }\r\n    public int Nanosecond { get; }\r\n  }\r\n}\r\nMicrosoft.Extensions.Caching\r\nWe added metrics support for IMemoryCache, which is a new API of MemoryCacheStatistics that holds cache hits, misses, and estimated size for IMemoryCache. You can get an instance of MemoryCacheStatistics by calling GetCurrentStatistics() when the flag TrackStatistics is enabled.\r\n\r\nThe GetCurrentStatistics() API allows app developers to use event counters or metrics APIs to track statistics for one or more memory cache.\r\n\r\n\/\/ when using `services.AddMemoryCache(options =&gt; options.TrackStatistics = true);` to instantiate\r\n[EventSource(Name = \"Microsoft-Extensions-Caching-Memory\")]\r\ninternal sealed class CachingEventSource : EventSource\r\n{\r\n  public CachingEventSource(IMemoryCache memoryCache)\r\n  {\r\n    _memoryCache = memoryCache;\r\n  }\r\n  protected override void OnEventCommand(EventCommandEventArgs command)\r\n  {\r\n    if (command.Command == EventCommand.Enable)\r\n    {\r\n      if (_cacheHitsCounter == null)\r\n      {\r\n          _cacheHitsCounter = new PollingCounter(\"cache-hits\", this, () =&gt; _memoryCache.GetCurrentStatistics().CacheHits)\r\n          {\r\n            DisplayName = \"Cache hits\",\r\n          };\r\n      }\r\n    }\r\n  }\r\n}<\/pre>\n<p><strong>Microsoft.Extensions.Caching<\/strong><\/p>\n<p>\u6211\u4eec\u6dfb\u52a0\u4e86\u5bf9<span style=\"color: #ff0000;\"> IMemoryCache<\/span> \u7684\u6307\u6807\u652f\u6301\uff0c\u8fd9\u662f MemoryCacheStatistics \u7684\u4e00\u4e2a\u65b0 API\uff0c\u7528\u4e8e\u4fdd\u5b58 IMemoryCache \u7684\u7f13\u5b58\u547d\u4e2d\u3001\u672a\u547d\u4e2d\u548c\u4f30\u8ba1\u5927\u5c0f\u3002 \u5f53\u542f\u7528\u6807\u5fd7 TrackStatistics \u65f6\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528 GetCurrentStatistics() \u6765\u83b7\u53d6 MemoryCacheStatistics \u7684\u5b9e\u4f8b\u3002<\/p>\n<p>GetCurrentStatistics() API \u5141\u8bb8\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\u4eba\u5458\u4f7f\u7528\u4e8b\u4ef6\u8ba1\u6570\u5668\u6216\u6307\u6807 API \u6765\u8ddf\u8e2a\u4e00\u4e2a\u6216\u591a\u4e2a\u5185\u5b58\u7f13\u5b58\u7684\u7edf\u8ba1\u4fe1\u606f\u3002<\/p>\n<pre class=\"prettyprint\">\/\/ when using `services.AddMemoryCache(options =&gt; options.TrackStatistics = true);` to instantiate\r\n[EventSource(Name = \"Microsoft-Extensions-Caching-Memory\")]\r\ninternal sealed class CachingEventSource : EventSource\r\n{\r\n  public CachingEventSource(IMemoryCache memoryCache)\r\n  {\r\n    _memoryCache = memoryCache;\r\n  }\r\n  protected override void OnEventCommand(EventCommandEventArgs command)\r\n  {\r\n    if (command.Command == EventCommand.Enable)\r\n    {\r\n      if (_cacheHitsCounter == null)\r\n      {\r\n          _cacheHitsCounter = new PollingCounter(\"cache-hits\", this, () =&gt; _memoryCache.GetCurrentStatistics().CacheHits)\r\n          {\r\n            DisplayName = \"Cache hits\",\r\n          };\r\n      }\r\n    }\r\n  }\r\n}<\/pre>\n<p>\u7136\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<span style=\"color: #ff0000;\"> dotnet-counters<\/span> \u5de5\u5177\u67e5\u770b\u4ee5\u4e0b\u7edf\u8ba1\u4fe1\u606f\uff1a<\/p>\n<pre class=\"prettyprint\">Press p to pause, r to resume, q to quit.\r\n    Status: Running\r\n\r\n[System.Runtime]\r\n    CPU Usage (%)                                      0\r\n    Working Set (MB)                                  28\r\n[Microsoft-Extensions-Caching-MemoryCache]\r\n    cache-hits                                       269<\/pre>\n<p><strong>System.Formats.Tar APIs<\/strong><\/p>\n<p>\u6211\u4eec\u6dfb\u52a0\u4e86\u4e00\u4e2a\u65b0\u7684 System.Formats.Tar \u7a0b\u5e8f\u96c6\uff0c\u5176\u4e2d\u5305\u542b\u5141\u8bb8\u8bfb\u53d6\u3001\u5199\u5165\u3001\u5f52\u6863\u548c\u63d0\u53d6 Tar \u6863\u6848\u7684\u8de8\u5e73\u53f0 API\u3002 SDK \u751a\u81f3\u4f7f\u7528\u8fd9\u4e9b API \u6765\u521b\u5efa\u5bb9\u5668\u4f5c\u4e3a\u53d1\u5e03\u76ee\u6807\u3002<\/p>\n<pre class=\"prettyprint\">\/\/ Generates a tar archive where all the entry names are prefixed by the root directory 'SourceDirectory'\r\nTarFile.CreateFromDirectory(sourceDirectoryName: \"\/home\/dotnet\/SourceDirectory\/\", destinationFileName: \"\/home\/dotnet\/destination.tar\", includeBaseDirectory: true);\r\n\r\n\/\/ Extracts the contents of a tar archive into the specified directory, but avoids overwriting anything found inside\r\nTarFile.ExtractToDirectory(sourceFileName: \"\/home\/dotnet\/destination.tar\", destinationDirectoryName: \"\/home\/dotnet\/DestinationDirectory\/\", overwriteFiles: false);<\/pre>\n<p><strong>\u7c7b\u578b\u8f6c\u6362\u5668<\/strong><\/p>\n<p>\u73b0\u5728\u6709\u9488\u5bf9\u65b0\u6dfb\u52a0\u7684\u539f\u59cb\u7c7b\u578b DateOnly\u3001TimeOnly\u3001Int128\u3001UInt128 \u548c Half \u7684\u516c\u5f00\u7c7b\u578b\u8f6c\u6362\u5668\u3002<\/p>\n<pre class=\"prettyprint\">namespace System.ComponentModel\r\n{\r\n  public class DateOnlyConverter : System.ComponentModel.TypeConverter\r\n  {\r\n    public DateOnlyConverter() { }\r\n  }\r\n\r\n  public class TimeOnlyConverter : System.ComponentModel.TypeConverter\r\n  {\r\n    public TimeOnlyConverter() { }\r\n  }\r\n\r\n  public class Int128Converter : System.ComponentModel.BaseNumberConverter\r\n  {\r\n    public Int128Converter() { }\r\n  }\r\n\r\n  public class UInt128Converter : System.ComponentModel.BaseNumberConverter\r\n  {\r\n    public UInt128Converter() { }\r\n  }\r\n\r\n  public class HalfConverter : System.ComponentModel.BaseNumberConverter\r\n  {\r\n    public HalfConverter() { }\r\n  }\r\n}<\/pre>\n<p>\u8fd9\u4e9b\u662f\u6709\u7528\u7684\u8f6c\u6362\u5668\uff0c\u53ef\u4ee5\u8f7b\u677e\u8f6c\u6362\u4e3a\u66f4\u539f\u59cb\u7684\u7c7b\u578b\u3002<\/p>\n<pre class=\"prettyprint\">TypeConverter dateOnlyConverter = TypeDescriptor.GetConverter(typeof(DateOnly));\r\n\/\/ produce DateOnly value of DateOnly(1940, 10, 9)\r\nDateOnly? date = dateOnlyConverter.ConvertFromString(\"1940-10-09\") as DateOnly?;\r\n\r\nTypeConverter timeOnlyConverter = TypeDescriptor.GetConverter(typeof(TimeOnly));\r\n\/\/ produce TimeOnly value of TimeOnly(20, 30, 50)\r\nTimeOnly? time = timeOnlyConverter.ConvertFromString(\"20:30:50\") as TimeOnly?;\r\n\r\nTypeConverter halfConverter = TypeDescriptor.GetConverter(typeof(Half));\r\n\/\/ produce Half value of -1.2\r\nHalf? half = halfConverter.ConvertFromString(((Half)(-1.2)).ToString()) as Half?;\r\n\r\nTypeConverter Int128Converter = TypeDescriptor.GetConverter(typeof(Int128));\r\n\/\/ produce Int128 value of Int128.MaxValue which equal 170141183460469231731687303715884105727\r\nInt128? int128 = Int128Converter.ConvertFromString(\"170141183460469231731687303715884105727\") as Int128?;\r\n\r\nTypeConverter UInt128Converter = TypeDescriptor.GetConverter(typeof(UInt128));\r\n\/\/ produce UInt128 value of UInt128.MaxValue Which equal 340282366920938463463374607431768211455\r\nUInt128? uint128 = UInt128Converter.ConvertFromString(\"340282366920938463463374607431768211455\") as UInt128?;<\/pre>\n<p><strong>System.Text.Json <\/strong><strong>\u5408\u7ea6\u5b9a\u5236<\/strong><\/p>\n<p>System.Text.Json \u901a\u8fc7\u4e3a\u8be5\u7c7b\u578b\u6784\u9020 JSON \u5951\u7ea6\u6765\u786e\u5b9a\u7ed9\u5b9a .NET \u7c7b\u578b\u5982\u4f55\u88ab\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u3002 \u5951\u7ea6\u6d3e\u751f\u81ea\u7c7b\u578b\u7684\u5f62\u72b6\u2014\u2014\u4f8b\u5982\u5176\u53ef\u7528\u7684\u6784\u9020\u51fd\u6570\u3001\u5c5e\u6027\u548c\u5b57\u6bb5\uff0c\u4ee5\u53ca\u5b83\u662f\u5426\u5b9e\u73b0 <span style=\"color: #ff0000;\">IEnumerable<\/span> \u6216 <span style=\"color: #ff0000;\">IDictionary<\/span>\u2014\u2014\u5728\u8fd0\u884c\u65f6\u4f7f\u7528\u53cd\u5c04\u6216\u5728\u7f16\u8bd1\u65f6\u4f7f\u7528\u6e90\u751f\u6210\u5668\u3002 \u5728\u4ee5\u524d\u7684\u7248\u672c\u4e2d\uff0c\u5047\u8bbe\u7528\u6237\u80fd\u591f\u4fee\u6539\u7c7b\u578b\u58f0\u660e\uff0c\u4ed6\u4eec\u53ef\u4ee5\u4f7f\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.serialization.jsonattribute\">System.Text.Json \u5c5e\u6027\u6ce8\u91ca<\/a>\u5bf9\u6d3e\u751f\u5408\u7ea6\u8fdb\u884c\u6709\u9650\u7684\u8c03\u6574\u3002<\/p>\n<p>\u7ed9\u5b9a\u7c7b\u578b T \u7684\u5408\u7ea6\u5143\u6570\u636e\u4f7f\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.serialization.metadata.jsontypeinfo-1\">JsonTypeInfo&lt;T&gt;<\/a> \u8868\u793a\uff0c\u5728\u4ee5\u524d\u7684\u7248\u672c\u4e2d\uff0c\u5b83\u7528\u4f5c\u6e90\u751f\u6210\u5668 API \u4e2d\u4e13\u7528\u7684\u4e0d\u900f\u660e\u4ee4\u724c\u3002 \u4ece .NET 7 \u5f00\u59cb\uff0cJsonTypeInfo \u5408\u540c\u5143\u6570\u636e\u7684\u5927\u591a\u6570\u65b9\u9762\u90fd\u5df2\u516c\u5f00\u5e76\u53ef\u4f9b\u7528\u6237\u4fee\u6539\u3002 \u5408\u7ea6\u5b9a\u5236\u5141\u8bb8\u7528\u6237\u4f7f\u7528 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.serialization.metadata.ijsontypeinforesolver\">IJsonTypeInfoResolver<\/a> \u63a5\u53e3\u7684\u5b9e\u73b0\u7f16\u5199\u81ea\u5df1\u7684 JSON \u5408\u7ea6\u89e3\u6790\u903b\u8f91\uff1a<\/p>\n<pre class=\"prettyprint\">public interface IJsonTypeInfoResolver\r\n{\r\n  JsonTypeInfo? GetTypeInfo(Type type, JsonSerializerOptions options);\r\n}<\/pre>\n<p>\u5408\u540c\u89e3\u6790\u5668\u4e3a\u7ed9\u5b9a\u7684 Type \u548c <span style=\"color: #ff0000;\">JsonSerializerOptions<\/span> \u7ec4\u5408\u8fd4\u56de\u914d\u7f6e\u7684 <span style=\"color: #ff0000;\">JsonTypeInfo<\/span> \u5b9e\u4f8b\u3002 \u5982\u679c\u89e3\u6790\u5668\u4e0d\u652f\u6301\u6307\u5b9a\u8f93\u5165\u7c7b\u578b\u7684\u5143\u6570\u636e\uff0c\u5b83\u53ef\u4ee5\u8fd4\u56de null\u3002<\/p>\n<p>\u9ed8\u8ba4\u7684\u57fa\u4e8e\u53cd\u5c04\u7684\u5e8f\u5217\u5316\u7a0b\u5e8f\u6267\u884c\u7684\u5408\u540c\u89e3\u6790\u73b0\u5728\u901a\u8fc7\u5b9e\u73b0 IJsonTypeInfoResolver \u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.serialization.metadata.defaultjsontypeinforesolver\">DefaultJsonTypeInfoResolver<\/a> \u7c7b\u516c\u5f00\u3002 \u6b64\u7c7b\u5141\u8bb8\u7528\u6237\u901a\u8fc7\u81ea\u5b9a\u4e49\u4fee\u6539\u6269\u5c55\u9ed8\u8ba4\u7684\u57fa\u4e8e\u53cd\u5c04\u7684\u89e3\u6790\uff0c\u6216\u5c06\u5176\u4e0e\u5176\u4ed6\u89e3\u6790\u5668\uff08\u4f8b\u5982\u6e90\u751f\u6210\u7684\u89e3\u6790\u5668\uff09\u7ed3\u5408\u4f7f\u7528\u3002<\/p>\n<p>\u4ece .NET 7 \u5f00\u59cb\uff0c\u6e90\u751f\u6210\u4e2d\u4f7f\u7528\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.serialization.jsonserializercontext\">JsonSerializerContext<\/a> \u7c7b\u4e5f\u5b9e\u73b0\u4e86 IJsonTypeInfoResolver\u3002 \u8981\u4e86\u89e3\u6709\u5173\u6e90\u751f\u6210\u5668\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605<a href=\"https:\/\/learn.microsoft.com\/dotnet\/standard\/serialization\/system-text-json\/source-generation\">\u5982\u4f55\u5728 System.Text.Json \u4e2d\u4f7f\u7528\u6e90\u751f\u6210<\/a>\u3002<\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u65b0\u7684 <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.jsonserializeroptions.typeinforesolver\">TypeInfoResolver<\/a> \u5c5e\u6027\u4e3a JsonSerializerOptions \u5b9e\u4f8b\u914d\u7f6e\u81ea\u5b9a\u4e49\u89e3\u6790\u5668\uff1a<\/p>\n<pre class=\"prettyprint\">\/\/ configure to use reflection contracts\r\nvar reflectionOptions = new JsonSerializerOptions\r\n{\r\n    TypeInfoResolver = new DefaultJsonTypeInfoResolver()\r\n};\r\n\r\n\/\/ configure to use source generated contracts\r\nvar sourceGenOptions = new JsonSerializerOptions\r\n{\r\n    TypeInfoResolver = EntryContext.Default\r\n};\r\n\r\n[JsonSerializable(typeof(MyPoco))]\r\npublic partial class EntryContext : JsonSerializerContext { }<\/pre>\n<p>\u67e5\u770b [<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/system-text-json-in-dotnet-7\/#contract-customization\">What&#8217;s new in System.Text.Json in .NET 7<\/a>] \u535a\u5ba2\u6587\u7ae0\uff0c\u4e86\u89e3\u6709\u5173\u5408\u540c\u81ea\u5b9a\u4e49\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p><strong>System.Text.Json <\/strong><strong>\u7c7b\u578b\u5c42\u6b21\u7ed3\u6784<\/strong><\/p>\n<p>System.Text.Json \u73b0\u5728\u652f\u6301\u7528\u6237\u5b9a\u4e49\u7c7b\u578b\u5c42\u6b21\u7ed3\u6784\u7684\u591a\u6001\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u3002 \u8fd9\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u65b0\u7684 <a href=\"https:\/\/docs.microsoft.com\/dotnet\/api\/system.text.json.serialization.jsonderivedtypeattribute\">JsonDerivedTypeAttribute<\/a> \u88c5\u9970\u7c7b\u578b\u5c42\u6b21\u7ed3\u6784\u7684\u57fa\u7c7b\u6765\u542f\u7528\uff1a<\/p>\n<pre class=\"prettyprint\">[JsonDerivedType(typeof(Derived))]\r\npublic class Base\r\n{\r\n    public int X { get; set; }\r\n}\r\n\r\npublic class Derived : Base\r\n{\r\n    public int Y { get; set; }\r\n}<\/pre>\n<p>\u6b64\u914d\u7f6e\u4e3a Base \u542f\u7528\u591a\u6001\u5e8f\u5217\u5316\uff0c\u7279\u522b\u662f\u5728\u8fd0\u884c\u65f6\u7c7b\u578b\u4e3a Derived \u65f6\uff1a<\/p>\n<pre class=\"prettyprint\">Base value = new Derived();\r\nJsonSerializer.Serialize&lt;Base&gt;(value); \/\/ { \"X\" : 0, \"Y\" : 0 }<\/pre>\n<p>\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0d\u4f1a\u542f\u7528\u591a\u6001\u53cd\u5e8f\u5217\u5316\uff0c\u56e0\u4e3a\u6709\u6548\u8d1f\u8f7d\u5c06\u4f5c\u4e3a Base \u5f80\u8fd4\uff1a<\/p>\n<pre class=\"prettyprint\">Base value = JsonSerializer.Deserialize&lt;Base&gt;(@\"{ \"\"X\"\" : 0, \"\"Y\"\" : 0 }\");\r\nvalue is Derived; \/\/ false<\/pre>\n<p>\u67e5\u770b <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/system-text-json-in-dotnet-7\/#type-hierarchies\">.NET 7 \u4e2d System.Text.Json \u7684\u65b0\u589e\u529f\u80fd\u535a\u5ba2\u6587\u7ae0<\/a>\uff0c\u4e86\u89e3\u6709\u5173\u7c7b\u578b\u5c42\u6b21\u7ed3\u6784\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<p><strong>.NET SDK<\/strong><\/p>\n<p>.NET SDK \u7ee7\u7eed\u6dfb\u52a0\u65b0\u529f\u80fd\uff0c\u8ba9\u60a8\u6bd4\u4ee5\u5f80\u4efb\u4f55\u65f6\u5019\u90fd\u66f4\u6709\u6548\u7387\u3002 \u5728 .NET 7 \u4e2d\uff0c\u6211\u4eec\u6539\u8fdb\u4e86\u60a8\u4f7f\u7528 .NET CLI\u3001\u521b\u4f5c\u6a21\u677f\u548c\u5728\u4e2d\u592e\u4f4d\u7f6e\u7ba1\u7406\u5305\u7684\u4f53\u9a8c\u3002<\/p>\n<p><strong>CLI <\/strong><strong>\u89e3\u6790\u5668\u548c\u9009\u9879\u5361\u5b8c\u6210<\/strong><\/p>\n<p><span style=\"color: #ff0000;\">dotnet new<\/span> \u547d\u4ee4\u4e3a\u7528\u6237\u719f\u6089\u548c\u559c\u7231\u7684\u8bb8\u591a\u5b50\u547d\u4ee4\u63d0\u4f9b\u4e86\u66f4\u52a0\u4e00\u81f4\u548c\u76f4\u89c2\u7684\u754c\u9762\u3002 \u8fd8\u652f\u6301\u6a21\u677f\u9009\u9879\u548c\u53c2\u6570\u7684\u5236\u8868\u7b26\u5b8c\u6210\u3002 CLI \u73b0\u5728\u4f1a\u5728\u7528\u6237\u952e\u5165\u65f6\u63d0\u4f9b\u6709\u5173\u6709\u6548\u53c2\u6570\u548c\u9009\u9879\u7684\u53cd\u9988\u3002<\/p>\n<p>\u4ee5\u4e0b\u662f\u65b0\u7684\u5e2e\u52a9\u8f93\u51fa\u793a\u4f8b\uff1a<\/p>\n<pre class=\"prettyprint\">\u276f dotnet new --help\r\nDescription:\r\n  Template Instantiation Commands for .NET CLI.\r\n\r\nUsage:\r\n  dotnet new [&lt;template-short-name&gt; [&lt;template-args&gt;...]] [options]\r\n  dotnet new [command] [options]\r\n\r\nArguments:\r\n  &lt;template-short-name&gt;  A short name of the template to create.\r\n  &lt;template-args&gt;        Template specific options to use.\r\n\r\nOptions:\r\n  -?, -h, --help  Show command line help.\r\n\r\nCommands:\r\n  install &lt;package&gt;       Installs a template package.\r\n  uninstall &lt;package&gt;     Uninstalls a template package.\r\n  update                  Checks the currently installed template packages for update, and install the updates.\r\n  search &lt;template-name&gt;  Searches for the templates on NuGet.org.\r\n  list &lt;template-name&gt;    Lists templates containing the specified template name. If no name is specified, lists all templates.<\/pre>\n<p>\u4e00\u76f4\u4ee5\u6765\uff0cdotnet CLI \u90fd\u652f\u6301 tab \u8865\u5168\uff0c\u5176\u4e2d\u5305\u62ec PowerShell\u3001bash\u3001zsh \u548c fish \u7b49\u6d41\u884c\u7684 shell\u3002 \u7136\u800c\uff0c\u5b9e\u73b0\u6709\u610f\u4e49\u7684\u8865\u5168\u53d6\u51b3\u4e8e\u5355\u72ec\u7684 dotnet \u547d\u4ee4\u3002 \u5bf9\u4e8e .NET 7\uff0cdotnet new \u547d\u4ee4\u5b66\u4e60\u4e86\u5982\u4f55\u63d0\u4f9b\u5236\u8868\u7b26\u8865\u5168\u3002<\/p>\n<pre class=\"prettyprint\">\u276f dotnet new angular\r\nangular              grpc                 razor                viewstart            worker               -h\r\nblazorserver         mstest               razorclasslib        web                  wpf                  \/?\r\nblazorwasm           mvc                  razorcomponent       webapi               wpfcustomcontrollib  \/h\r\nclasslib             nugetconfig          react                webapp               wpflib               install\r\nconsole              nunit                reactredux           webconfig            wpfusercontrollib    list\r\neditorconfig         nunit-test           sln                  winforms             xunit                search\r\ngitignore            page                 tool-manifest        winformscontrollib   --help               uninstall\r\nglobaljson           proto                viewimports          winformslib          -?                   update<\/pre>\n<p>\u8fd9\u6709\u52a9\u4e8e\u60a8\u5728\u521b\u5efa\u65b0\u7684 .NET \u9879\u76ee\u65f6\u505a\u51fa\u9009\u62e9\uff0c\u4ee5\u4e86\u89e3\u54ea\u4e9b\u9009\u9879\u548c\u53c2\u6570\u53ef\u4f9b\u60a8\u4f7f\u7528\u3002<\/p>\n<pre class=\"prettyprint\">\u276f dotnet new web --dry-run\r\n--dry-run                  --language                 --output                   -lang\r\n--exclude-launch-settings  --name                     --type                     -n\r\n--force                    --no-https                 -?                         -o\r\n--framework                --no-restore               -f                         \/?\r\n--help                     --no-update-check          -h                         \/h<\/pre>\n<p>\u6b64\u5916\uff0c\u7ed9\u5b9a\u547d\u4ee4\u901a\u5e38\u9519\u8bef\u6216\u4e0d\u652f\u6301\u54ea\u4e9b\u5e38\u89c1\u9009\u9879\u548c\u53c2\u6570\u3002 \u76f8\u53cd\uff0c\u60a8\u53ea\u4f1a\u770b\u5230\u5f53\u524d\u7248\u672c\u7684 .NET CLI \u652f\u6301\u7684\u5185\u5bb9\u3002<\/p>\n<pre class=\"prettyprint\">\u276f dotnet new blazorserver --auth Individual\r\nIndividual     IndividualB2C  MultiOrg       None           SingleOrg      Windows<\/pre>\n<p><strong>\u6a21\u677f\u521b\u4f5c<\/strong><\/p>\n<p>.NET 7 \u5c06\u7ea6\u675f\u7684\u6982\u5ff5\u6dfb\u52a0\u5230 .NET \u6a21\u677f\u3002 \u7ea6\u675f\u5141\u8bb8\u60a8\u5b9a\u4e49\u5141\u8bb8\u6a21\u677f\u7684\u4e0a\u4e0b\u6587\uff0c\u8fd9\u6709\u52a9\u4e8e\u6a21\u677f\u5f15\u64ce\u786e\u5b9a\u5e94\u5728 dotnet new list \u7b49\u547d\u4ee4\u4e2d\u663e\u793a\u54ea\u4e9b\u6a21\u677f\u3002 \u5728\u6b64\u7248\u672c\u4e2d\uff0c\u6211\u4eec\u6dfb\u52a0\u4e86\u5bf9\u4e09\u79cd\u7c7b\u578b\u7ea6\u675f\u7684\u652f\u6301\uff1a<\/p>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7edf\uff1a\u6839\u636e\u7528\u6237\u7684\u64cd\u4f5c\u7cfb\u7edf\u9650\u5236\u6a21\u677f<\/li>\n<li>\u6a21\u677f\u5f15\u64ce\u4e3b\u673a\uff1a\u6839\u636e\u6267\u884c\u6a21\u677f\u5f15\u64ce\u7684\u4e3b\u673a\u6765\u9650\u5236\u6a21\u677f\u3002 \u8fd9\u901a\u5e38\u662f .NET CLI \u672c\u8eab\uff0c\u6216\u8005\u662f\u5d4c\u5165\u5f0f\u573a\u666f\uff0c\u5982 Visual Studio \u6216 Visual Studio for Mac \u4e2d\u7684\u201c\u65b0\u5efa\u9879\u76ee\u201d\u5bf9\u8bdd\u6846\u3002<\/li>\n<li>\u5df2\u5b89\u88c5\u7684\u5de5\u4f5c\u8d1f\u8f7d\uff1a\u8981\u6c42\u5728\u6a21\u677f\u53ef\u7528\u4e4b\u524d\u5b89\u88c5\u6307\u5b9a\u7684 .NET SDK \u5de5\u4f5c\u8d1f\u8f7d\u3002<\/li>\n<\/ul>\n<p>\u5728\u6240\u6709\u60c5\u51b5\u4e0b\uff0c\u63cf\u8ff0\u8fd9\u4e9b\u7ea6\u675f\u5c31\u50cf\u5728\u6a21\u677f\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u7ea6\u675f\u90e8\u5206\u4e00\u6837\u7b80\u5355\uff1a<\/p>\n<pre class=\"prettyprint\">\"constraints\": {\r\n       \"web-assembly\": {\r\n           \"type\": \"workload\",\r\n           \"args\": \"wasm-tools\"\r\n       },\r\n   }<\/pre>\n<p>\u6211\u4eec\u8fd8\u6dfb\u52a0\u4e86\u9009\u62e9\u53c2\u6570\u7684\u65b0\u529f\u80fd\u3002 \u8fd9\u662f\u7528\u6237\u5728\u5355\u4e2a\u9009\u62e9\u4e2d\u6307\u5b9a\u591a\u4e2a\u503c\u7684\u80fd\u529b\u3002 \u8fd9\u53ef\u4ee5\u4ee5\u4e0e\u4f7f\u7528\u6807\u5fd7\u6837\u5f0f\u679a\u4e3e\u76f8\u540c\u7684\u65b9\u5f0f\u4f7f\u7528\u3002 \u6b64\u7c7b\u53c2\u6570\u7684\u5e38\u89c1\u793a\u4f8b\u53ef\u80fd\u662f\uff1a<\/p>\n<ul>\n<li>\u5728 Web \u6a21\u677f\u4e0a\u9009\u62e9\u591a\u79cd\u5f62\u5f0f\u7684\u8eab\u4efd\u9a8c\u8bc1\u3002<\/li>\n<li>\u5728 MAUI \u6a21\u677f\u4e2d\u4e00\u6b21\u9009\u62e9\u591a\u4e2a\u76ee\u6807\u5e73\u53f0\uff08iOS\u3001Android\u3001Web\uff09\u3002<\/li>\n<\/ul>\n<p>\u9009\u62e9\u52a0\u5165\u6b64\u884c\u4e3a\u5c31\u50cf\u5728\u6a21\u677f\u914d\u7f6e\u4e2d\u7684\u53c2\u6570\u5b9a\u4e49\u4e2d\u6dfb\u52a0<span style=\"color: #ff0000;\"> &#8220;allowMultipleValues&#8221;: true<\/span> \u4e00\u6837\u7b80\u5355\u3002 \u5b8c\u6210\u540e\uff0c\u60a8\u5c06\u53ef\u4ee5\u8bbf\u95ee\u591a\u4e2a\u5e2e\u52a9\u51fd\u6570\u4ee5\u5728\u6a21\u677f\u5185\u5bb9\u4e2d\u4f7f\u7528\uff0c\u5e76\u5e2e\u52a9\u68c0\u6d4b\u7528\u6237\u9009\u62e9\u7684\u7279\u5b9a\u503c\u3002<\/p>\n<p><strong>\u4e2d\u592e\u5305\u7ba1\u7406<\/strong><\/p>\n<p>\u4f9d\u8d56\u7ba1\u7406\u662f NuGet \u7684\u6838\u5fc3\u529f\u80fd\u3002 \u7ba1\u7406\u5355\u4e2a\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u5f88\u5bb9\u6613\u3002 \u7ba1\u7406\u591a\u9879\u76ee\u89e3\u51b3\u65b9\u6848\u7684\u4f9d\u8d56\u5173\u7cfb\u53ef\u80fd\u4f1a\u53d8\u5f97\u5f88\u56f0\u96be\uff0c\u56e0\u4e3a\u5b83\u4eec\u7684\u89c4\u6a21\u548c\u590d\u6742\u6027\u5f00\u59cb\u6269\u5927\u3002 \u5728\u60a8\u7ba1\u7406\u8bb8\u591a\u4e0d\u540c\u9879\u76ee\u7684\u516c\u5171\u4f9d\u8d56\u9879\u7684\u60c5\u51b5\u4e0b\uff0c\u60a8\u53ef\u4ee5\u5229\u7528 NuGet \u7684\u4e2d\u592e\u5305\u7ba1\u7406\u529f\u80fd\u4ece\u4e00\u4e2a\u4f4d\u7f6e\u8f7b\u677e\u5b8c\u6210\u6240\u6709\u8fd9\u4e9b\u5de5\u4f5c\u3002<\/p>\n<p>\u8981\u5f00\u59cb\u96c6\u4e2d\u5305\u7ba1\u7406\uff0c\u60a8\u53ef\u4ee5\u5728\u89e3\u51b3\u65b9\u6848\u7684\u6839\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a Directory.Packages.props \u6587\u4ef6\uff0c\u5e76\u5c06 MSBuild \u5c5e\u6027 ManagePackageVersionsCentrally \u8bbe\u7f6e\u4e3a true\u3002<\/p>\n<p>\u5728\u5185\u90e8\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b9a\u4e49\u5305 ID \u548c\u7248\u672c\u7684 &lt;PackageVersion \/&gt; \u5143\u7d20\u5b9a\u4e49\u89e3\u51b3\u65b9\u6848\u6240\u9700\u7684\u5404\u4e2a\u5305\u7248\u672c\u3002<\/p>\n<pre class=\"prettyprint\">&lt;Project&gt;\r\n  &lt;PropertyGroup&gt;\r\n    &lt;ManagePackageVersionsCentrally&gt;true&lt;\/ManagePackageVersionsCentrally&gt;\r\n  &lt;\/PropertyGroup&gt;\r\n\r\n  &lt;ItemGroup&gt;\r\n    &lt;PackageVersion Include=\"Newtonsoft.Json\" Version=\"13.0.1\" \/&gt;\r\n  &lt;\/ItemGroup&gt;\r\n&lt;\/Project&gt;<\/pre>\n<p>\u5728\u89e3\u51b3\u65b9\u6848\u7684\u9879\u76ee\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u60a8\u719f\u6089\u548c\u559c\u7231\u7684\u76f8\u5e94 &lt;PackageReference \/&gt; \u8bed\u6cd5\uff0c\u4f46\u6ca1\u6709 Version \u5c5e\u6027\u6765\u63a8\u65ad\u96c6\u4e2d\u7ba1\u7406\u7684\u7248\u672c\u3002<\/p>\n<pre class=\"prettyprint\">&lt;Project Sdk=\"Microsoft.NET.Sdk\"&gt;\r\n\r\n  &lt;PropertyGroup&gt;\r\n    &lt;TargetFramework&gt;net6.0&lt;\/TargetFramework&gt;\r\n  &lt;\/PropertyGroup&gt;\r\n\r\n  &lt;ItemGroup&gt;\r\n    &lt;PackageReference Include=\"Newtonsoft.Json\" \/&gt;\r\n  &lt;\/ItemGroup&gt;\r\n&lt;\/Project&gt;<\/pre>\n<p><strong>\u6027\u80fd<\/strong><\/p>\n<p>\u6027\u80fd\u4e00\u76f4\u662f\u6bcf\u4e2a .NET \u7248\u672c\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\u3002 \u6bcf\u5e74\uff0c.NET \u56e2\u961f\u90fd\u4f1a\u53d1\u5e03\u4e00\u7bc7\u5173\u4e8e\u6700\u65b0\u6539\u8fdb\u7684\u535a\u5ba2\u3002 \u4ee5\u4e0b\u662f\u6700\u65b0\u6027\u80fd\u5e16\u5b50\u7684\u7b80\u8981\u6982\u8ff0\uff1a<\/p>\n<p><em>TL\uff1bDR\uff1a.NET 7 \u901f\u5ea6\u5f88\u5feb\u3002\u5728\u8fd9\u4e2a\u7248\u672c\u4e2d\uff0c\u4e00\u5343\u591a\u4e2a\u5f71\u54cd\u6027\u80fd\u7684 PR \u8fdb\u5165\u4e86\u8fd0\u884c\u65f6\u548c\u6838\u5fc3\u5e93\uff0c\u66f4\u4e0d\u7528\u8bf4 ASP.NET Core \u548c Windows Forms \u548c Entity Framework \u53ca\u5176\u4ed6\u65b9\u9762\u7684\u6240\u6709\u6539\u8fdb\u3002 \u8fd9\u662f\u6709\u53f2\u4ee5\u6765\u6700\u5feb\u7684 .NET\u3002 \u5982\u679c\u4f60\u7684\u7ecf\u7406\u95ee\u4f60\u4e3a\u4ec0\u4e48\u4f60\u7684\u9879\u76ee\u5e94\u8be5\u5347\u7ea7\u5230 .NET 7\uff0c\u4f60\u53ef\u4ee5\u8bf4\u201c\u9664\u4e86\u53d1\u884c\u7248\u4e2d\u7684\u6240\u6709\u65b0\u529f\u80fd\u4e4b\u5916\uff0c.NET7\u8d85\u7ea7\u5feb\u201d\u3002\u2013 <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/performance_improvements_in_net_7\/\">Stephen Toub<\/a><\/em><\/p>\n<p>\u4e0b\u9762\u662f\u5bf9 JIT \u7f16\u8bd1\u5668\u7684\u4e00\u4e9b\u6027\u80fd\u6539\u8fdb\u7684\u7b80\u8981\u603b\u7ed3\u3002 \u5982\u679c\u60a8\u60f3\u5168\u9762\u6df1\u5165\u4e86\u89e3\u6240\u6709\u66f4\u6539\uff0c\u8bf7\u67e5\u770b .<a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/performance_improvements_in_net_7\/\">NET 7 \u4e2d\u7684\u6027\u80fd\u6539\u8fdb\u3002<\/a><\/p>\n<p><strong>On Stack Replacement (OSR)<\/strong><\/p>\n<p>\u5806\u6808\u4e0a\u66ff\u6362 (OSR) \u5141\u8bb8\u8fd0\u884c\u65f6\u5728\u65b9\u6cd5\u6267\u884c\u8fc7\u7a0b\u4e2d\u66f4\u6539\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u65b9\u6cd5\u6267\u884c\u7684\u4ee3\u7801\uff0c\u5c3d\u7ba1\u8fd9\u4e9b\u65b9\u6cd5\u5728\u201c\u5806\u6808\u4e0a\u201d\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u3002 \u5b83\u4f5c\u4e3a\u5206\u5c42\u7f16\u8bd1\u7684\u8865\u5145\u3002<\/p>\n<p>OSR \u5141\u8bb8\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u65b9\u6cd5\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\u5207\u6362\u5230\u66f4\u4f18\u5316\u7684\u7248\u672c\uff0c\u56e0\u6b64\u8fd0\u884c\u65f6\u53ef\u4ee5\u9996\u5148\u5feb\u901f JIT \u6240\u6709\u65b9\u6cd5\uff0c\u7136\u540e\u5728\u901a\u8fc7\u5206\u5c42\u7f16\u8bd1\u9891\u7e41\u8c03\u7528\u8fd9\u4e9b\u65b9\u6cd5\u6216\u901a\u8fc7\u957f\u65f6\u95f4\u8fd0\u884c\u5faa\u73af\u65f6\u8fc7\u6e21\u5230\u66f4\u4f18\u5316\u7684\u7248\u672c \u64cd\u4f5c\u7cfb\u7edf\u3002<\/p>\n<p>OSR \u63d0\u9ad8\u4e86\u542f\u52a8\u65f6\u95f4\u3002 \u51e0\u4e4e\u6240\u6709\u7684\u65b9\u6cd5\u73b0\u5728\u6700\u521d\u90fd\u662f\u7531\u5feb\u901f JIT \u8fdb\u884c\u7684\u3002 \u6211\u4eec\u5df2\u7ecf\u770b\u5230\u50cf Avalonia \u201cIL\u201d spy \u8fd9\u6837\u7684 jitting-heavy \u5e94\u7528\u7a0b\u5e8f\u7684\u542f\u52a8\u65f6\u95f4\u7f29\u77ed\u4e86 25%\uff0c\u6211\u4eec\u8ddf\u8e2a\u7684\u5404\u79cd TechEmpower \u57fa\u51c6\u6d4b\u8bd5\u663e\u793a\uff0c\u9996\u6b21\u8bf7\u6c42\u7684\u65f6\u95f4\u7f29\u77ed\u4e86 10-30%\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/Performance-TTFR.png\" \/><\/p>\n<p>OSR \u8fd8\u53ef\u4ee5\u63d0\u9ad8\u5e94\u7528\u7a0b\u5e8f\u7684\u6027\u80fd\uff0c\u5c24\u5176\u662f\u4f7f\u7528\u52a8\u6001 PGO \u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u56e0\u4e3a\u73b0\u5728\u53ef\u4ee5\u66f4\u597d\u5730\u4f18\u5316\u5e26\u6709\u5faa\u73af\u7684\u65b9\u6cd5\u3002 \u4f8b\u5982\uff0c\u542f\u7528 OSR \u540e\uff0cArray2 \u5fae\u57fa\u51c6\u6d4b\u8bd5\u663e\u793a\u51fa\u663e\u7740\u7684\u6539\u8fdb\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/Performance-Array2.png\" \/><\/p>\n<p><strong>Profile-Guided Optimization (PGO)<\/strong><\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u5f15\u5bfc\u4f18\u5316(PGO) \u5728\u8bb8\u591a\u8bed\u8a00\u548c\u7f16\u8bd1\u5668\u4e2d\u5df2\u7ecf\u5b58\u5728\u4e86\u5f88\u957f\u65f6\u95f4\u3002 \u57fa\u672c\u601d\u60f3\u662f\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f\uff0c\u8981\u6c42\u7f16\u8bd1\u5668\u5c06\u68c0\u6d4b\u6ce8\u5165\u5e94\u7528\u7a0b\u5e8f\u4ee5\u8ddf\u8e2a\u5404\u79cd\u6709\u8da3\u7684\u4fe1\u606f\u3002 \u7136\u540e\uff0c\u4f60\u8ba9\u4f60\u7684\u5e94\u7528\u7a0b\u5e8f\u901a\u8fc7\u5b83\u7684\u6b65\u4f10\uff0c\u8fd0\u884c\u5404\u79cd\u5e38\u89c1\u7684\u573a\u666f\uff0c\u4f7f\u8be5\u4eea\u5668\u201c\u5206\u6790\u201d\u5e94\u7528\u7a0b\u5e8f\u6267\u884c\u65f6\u53d1\u751f\u7684\u60c5\u51b5\uff0c\u7136\u540e\u4fdd\u5b58\u7ed3\u679c\u3002 \u7136\u540e\u91cd\u65b0\u7f16\u8bd1\u5e94\u7528\u7a0b\u5e8f\uff0c\u5c06\u8fd9\u4e9b\u68c0\u6d4b\u7ed3\u679c\u53cd\u9988\u7ed9\u7f16\u8bd1\u5668\uff0c\u5e76\u5141\u8bb8\u5b83\u4f18\u5316\u5e94\u7528\u7a0b\u5e8f\u4ee5\u51c6\u786e\u5730\u4f7f\u7528\u5b83\u3002<\/p>\n<p>\u8fd9\u79cd PGO \u65b9\u6cd5\u88ab\u79f0\u4e3a\u201c\u9759\u6001 PGO\u201d\uff0c\u56e0\u4e3a\u6240\u6709\u4fe1\u606f\u90fd\u662f\u5728\u5b9e\u9645\u90e8\u7f72\u4e4b\u524d\u6536\u96c6\u7684\uff0c\u800c\u8fd9\u4e5f\u662f .NET \u591a\u5e74\u6765\u4ee5\u5404\u79cd\u5f62\u5f0f\u6240\u505a\u7684\u4e8b\u60c5\u3002 .NET \u4e2d\u6709\u8da3\u7684\u53d1\u5c55\u662f\u201c\u52a8\u6001 PGO\u201d\uff0c\u5b83\u662f\u5728 .NET 6 \u4e2d\u5f15\u5165\u7684\uff0c\u4f46\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u662f\u5173\u95ed\u7684\u3002<\/p>\n<p>\u52a8\u6001 PGO \u5229\u7528\u5206\u5c42\u7f16\u8bd1\u3002 JIT \u68c0\u6d4b\u7b2c 0 \u5c42\u4ee3\u7801\u4ee5\u8ddf\u8e2a\u65b9\u6cd5\u88ab\u8c03\u7528\u7684\u6b21\u6570\uff0c\u6216\u8005\u5728\u5faa\u73af\u7684\u60c5\u51b5\u4e0b\uff0c\u5faa\u73af\u6267\u884c\u4e86\u591a\u5c11\u6b21\u3002 \u5206\u5c42\u7f16\u8bd1\u53ef\u4ee5\u63d0\u4f9b\u591a\u79cd\u53ef\u80fd\u6027\u3002 \u4f8b\u5982\uff0c\u5b83\u53ef\u4ee5\u51c6\u786e\u5730\u8ddf\u8e2a\u54ea\u4e9b\u5177\u4f53\u7c7b\u578b\u88ab\u7528\u4f5c\u63a5\u53e3\u8c03\u5ea6\u7684\u76ee\u6807\uff0c\u7136\u540e\u5728\u7b2c 1 \u5c42\u4e2d\uff0c\u4e13\u95e8\u5316\u4ee3\u7801\u4ee5\u671f\u671b\u6700\u5e38\u89c1\u7684\u7c7b\u578b\uff08\u8fd9\u88ab\u79f0\u4e3a\u201c\u53d7\u4fdd\u62a4\u7684\u53bb\u865a\u62df\u5316\u201d\u6216 GDV \uff09\u3002 \u4f60\u53ef\u4ee5\u5728\u8fd9\u4e2a\u5c0f\u4f8b\u5b50\u4e2d\u770b\u5230\u8fd9\u4e00\u70b9\u3002 \u5c06 DOTNET_TieredPGO \u73af\u5883\u53d8\u91cf\u8bbe\u7f6e\u4e3a 1\uff0c\u7136\u540e\u5728 .NET 7 \u4e0a\u8fd0\u884c\u5b83\uff1a<\/p>\n<pre class=\"prettyprint\">class Program\r\n{\r\n  static void Main()\r\n  {\r\n    IPrinter printer = new Printer();\r\n    for (int i = 0; ; i++)\r\n    {\r\n      DoWork(printer, i);\r\n    }\r\n  }\r\n\r\n  static void DoWork(IPrinter printer, int i)\r\n  {\r\n    printer.PrintIfTrue(I == int.MaxValue);\r\n  }\r\n\r\n  interface iPrinter\r\n  {\r\n    void PrintIfTrue(bool condition);\r\n  }\r\n\r\n  class Printer : iPrinter\r\n  {\r\n    public void PrintIfTrue(bool condition)\r\n    {\r\n      if (condition) Console.WriteLine\u201c\"Print\u201d\");\r\n    }\r\n  }\r\n}<\/pre>\n<p>\u4f7f\u7528 PGO \u83b7\u5f97\u7684\u4e3b\u8981\u6539\u8fdb\u662f\u5b83\u73b0\u5728\u53ef\u4ee5\u4e0e .NET 7 \u4e2d\u7684 OSR \u4e00\u8d77\u4f7f\u7528\u3002\u8fd9\u610f\u5473\u7740\u6267\u884c\u63a5\u53e3\u8c03\u5ea6\u7684\u70ed\u8fd0\u884c\u65b9\u6cd5\u53ef\u4ee5\u83b7\u5f97\u8fd9\u4e9b\u53bb\u865a\u62df\u5316\/\u5185\u8054\u4f18\u5316\u3002<\/p>\n<p>\u7981\u7528 PGO \u540e\uff0c\u60a8\u53ef\u4ee5\u83b7\u5f97\u76f8\u540c\u7684 .NET 6 \u548c .NET 7 \u6027\u80fd\u541e\u5410\u91cf\u3002<\/p>\n<table width=\"553\">\n<thead>\n<tr>\n<td><strong>\u65b9\u6cd5<\/strong><\/td>\n<td><strong>\u8fd0\u884c\u65f6<\/strong><\/td>\n<td><strong>\u5747\u503c<\/strong><\/td>\n<td><strong>\u6bd4\u7387<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>DelegatePGO<\/td>\n<td>.NET 6.0<\/td>\n<td>1.665 ns<\/td>\n<td>1.00<\/td>\n<\/tr>\n<tr>\n<td>DelegatePGO<\/td>\n<td>.NET 7.0<\/td>\n<td>1.659 ns<\/td>\n<td>1.00<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f46\u662f\uff0c\u5f53\u60a8\u901a\u8fc7 <span style=\"color: #ff0000;\">&lt;TieredPGO&gt;true&lt;\/TieredPGO&gt; <\/span>\u6216 <span style=\"color: #ff0000;\">DOTNET_TieredPGO=1<\/span> \u7684\u73af\u5883\u53d8\u91cf\u5728 .csproj \u4e2d\u542f\u7528\u52a8\u6001 PGO \u65f6\uff0c\u60c5\u51b5\u4f1a\u53d1\u751f\u53d8\u5316\u3002 .NET 6 \u7684\u901f\u5ea6\u63d0\u9ad8\u4e86\u7ea6 14%\uff0c\u4f46 .NET 7 \u7684\u901f\u5ea6\u63d0\u9ad8\u4e86\u7ea6 3 \u500d\u3002<\/p>\n<table style=\"width: 74.5879%;\" width=\"546\">\n<thead>\n<tr>\n<td style=\"width: 36.4641%;\"><strong>\u65b9\u6cd5<\/strong><\/td>\n<td style=\"width: 23.3886%;\"><strong>\u8fd0\u884c\u65f6<\/strong><\/td>\n<td style=\"width: 27.6243%;\"><strong>\u5747\u503c<\/strong><\/td>\n<td style=\"width: 12.3389%;\"><strong>\u6bd4\u7387<\/strong><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 36.4641%;\">DelegatePGO<\/td>\n<td style=\"width: 23.3886%;\">.NET 6.0<\/td>\n<td style=\"width: 27.6243%;\">1.427.7 ns<\/td>\n<td style=\"width: 12.3389%;\">1.00<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 36.4641%;\">DelegatePGO<\/td>\n<td style=\"width: 23.3886%;\">.NET 7.0<\/td>\n<td style=\"width: 27.6243%;\">539.0<\/td>\n<td style=\"width: 12.3389%;\">0.38<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Native AOT<\/strong><\/p>\n<p>\u5bf9\u4e8e\u8bb8\u591a\u4eba\u6765\u8bf4\uff0c\u8f6f\u4ef6\u4e0a\u4e0b\u6587\u4e2d\u7684\u201c\u6027\u80fd\u201d\u4e00\u8bcd\u4e0e\u541e\u5410\u91cf\u6709\u5173\u3002 \u5b83\u53ef\u4ee5\u6267\u884c\u591a\u5feb\uff1f \u5b83\u6bcf\u79d2\u53ef\u4ee5\u5904\u7406\u591a\u5c11\u6570\u636e\uff1f \u5b83\u6bcf\u79d2\u53ef\u4ee5\u5904\u7406\u591a\u5c11\u4e2a\u8bf7\u6c42\uff1f \u8fd8\u6709\u5f88\u591a\u3002 \u4f46\u6027\u80fd\u8fd8\u6709\u5f88\u591a\u5176\u4ed6\u65b9\u9762\u3002 \u5b83\u6d88\u8017\u591a\u5c11\u5185\u5b58\uff1f \u5b83\u4ee5\u591a\u5feb\u7684\u901f\u5ea6\u542f\u52a8\u5e76\u5f00\u59cb\u505a\u4e00\u4e9b\u6709\u7528\u7684\u4e8b\u60c5\uff1f \u5b83\u5728\u78c1\u76d8\u4e0a\u6d88\u8017\u591a\u5c11\u7a7a\u95f4\uff1f \u4e0b\u8f7d\u9700\u8981\u591a\u957f\u65f6\u95f4\uff1f<\/p>\n<p>\u7136\u540e\u662f\u76f8\u5173\u7684\u62c5\u5fe7\u3002 \u5b9e\u73b0\u8fd9\u4e9b\u76ee\u6807\u9700\u8981\u54ea\u4e9b\u4f9d\u8d56\u9879\uff1f \u5b83\u9700\u8981\u6267\u884c\u54ea\u4e9b\u7c7b\u578b\u7684\u64cd\u4f5c\u6765\u5b9e\u73b0\u8fd9\u4e9b\u76ee\u6807\uff0c\u4ee5\u53ca\u6240\u6709\u8fd9\u4e9b\u64cd\u4f5c\u5728\u76ee\u6807\u73af\u5883\u4e2d\u662f\u5426\u5141\u8bb8\uff1f \u5982\u679c\u8fd9\u4e00\u6bb5\u4e2d\u7684\u4efb\u4f55\u4e00\u6bb5\u5f15\u8d77\u4e86\u60a8\u7684\u5171\u9e23\uff0c\u90a3\u4e48\u60a8\u5c31\u662f\u73b0\u5728\u5728 .NET 7 \u4e2d\u63d0\u4f9b\u7684\u672c\u673a AOT \u652f\u6301\u7684\u76ee\u6807\u53d7\u4f17\u3002<\/p>\n<p>.NET \u957f\u671f\u4ee5\u6765\u4e00\u76f4\u652f\u6301 AOT \u4ee3\u7801\u751f\u6210\u3002 \u4f8b\u5982\uff0c.NET Framework \u6709 ngen \u7684\u5f62\u5f0f\uff0c.NET Core \u6709 crossgen \u7684\u5f62\u5f0f\u3002 \u8fd9\u4e24\u79cd\u89e3\u51b3\u65b9\u6848\u90fd\u6d89\u53ca\u4e00\u4e2a\u6807\u51c6\u7684 .NET \u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5176\u4e2d\u4e00\u4e9b IL \u5df2\u7ecf\u7f16\u8bd1\u4e3a\u6c47\u7f16\u4ee3\u7801\uff0c\u4f46\u5e76\u975e\u6240\u6709\u65b9\u6cd5\u90fd\u4f1a\u4e3a\u5b83\u4eec\u751f\u6210\u6c47\u7f16\u4ee3\u7801\uff0c\u5404\u79cd\u4e8b\u60c5\u90fd\u53ef\u80fd\u4f7f\u751f\u6210\u7684\u6c47\u7f16\u4ee3\u7801\u65e0\u6548\uff0c\u5916\u90e8 .NET \u7a0b\u5e8f\u96c6\u6ca1\u6709\u4efb\u4f55\u672c\u673a\u6c47\u7f16\u4ee3\u7801 \u52a0\u8f7d\u7b49\u7b49\uff0c\u5728\u6240\u6709\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c\u8fd0\u884c\u65f6\u8fd8\u662f\u7ee7\u7eed\u4f7f\u7528 JIT \u7f16\u8bd1\u5668\u3002\u800c\u539f\u751f AOT \u4e0d\u540c\uff0c\u5b83\u662f CoreRT \u7684\u6f14\u53d8\uff0cCoreRT \u672c\u8eab\u662f .NET Native \u7684\u6f14\u53d8\uff0c\u5b8c\u5168\u8131\u79bb\u4e8eJIT\u3002<\/p>\n<p>\u53d1\u5e03\u6784\u5efa\u751f\u6210\u7684\u4e8c\u8fdb\u5236\u6587\u4ef6\u662f\u76ee\u6807\u5e73\u53f0\u7279\u5b9a\u4e8e\u5e73\u53f0\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u4f8b\u5982\uff0cWindows \u4e0a\u7684 COFF\u3001Linux \u4e0a\u7684 ELF\u3001macOS \u4e0a\u7684 Mach-O\uff09\u7684\u5b8c\u5168\u72ec\u7acb\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u9664\u4e86\u6807\u51c6\u4e4b\u5916\u6ca1\u6709\u4efb\u4f55\u5916\u90e8\u4f9d\u8d56\u9879 \u5230\u8be5\u5e73\u53f0\uff08\u4f8b\u5982\uff0clibc\uff09\u3002 \u800c\u4e14\u5b83\u5b8c\u5168\u662f\u539f\u751f\u7684\uff1a\u770b\u4e0d\u5230 IL\uff0c\u6ca1\u6709 JIT\uff0c\u4ec0\u4e48\u90fd\u6ca1\u6709\u3002 \u6240\u6709\u5fc5\u9700\u7684\u4ee3\u7801\u90fd\u88ab\u7f16\u8bd1\u548c\/\u6216\u94fe\u63a5\u5230\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\uff0c\u5305\u62ec\u4e0e\u6807\u51c6 .NET \u5e94\u7528\u7a0b\u5e8f\u548c\u670d\u52a1\u4e00\u8d77\u4f7f\u7528\u7684\u76f8\u540c GC\uff0c\u4ee5\u53ca\u56f4\u7ed5\u7ebf\u7a0b\u7b49\u63d0\u4f9b\u670d\u52a1\u7684\u6700\u5c0f\u8fd0\u884c\u65f6\u3002<\/p>\n<p>\u6240\u6709\u8fd9\u4e9b\u90fd\u5e26\u6765\u4e86\u5de8\u5927\u7684\u597d\u5904\uff1a\u8d85\u5feb\u7684\u542f\u52a8\u65f6\u95f4\u3001\u5c0f\u578b\u4e14\u5b8c\u5168\u72ec\u7acb\u7684\u90e8\u7f72\uff0c\u4ee5\u53ca\u5728\u4e0d\u5141\u8bb8 JIT \u7f16\u8bd1\u5668\u7684\u5730\u65b9\u8fd0\u884c\u7684\u80fd\u529b\uff08\u56e0\u4e3a\u65e0\u6cd5\u6267\u884c\u53ef\u5199\u5185\u5b58\u9875\u9762\uff09\u3002 \u5b83\u4e5f\u5e26\u6765\u4e86\u9650\u5236\uff1a\u6ca1\u6709 JIT \u610f\u5473\u7740\u6ca1\u6709\u52a8\u6001\u52a0\u8f7d\u4efb\u610f\u7a0b\u5e8f\u96c6\uff08\u4f8b\u5982\uff0cAssembly.LoadFile\uff09\u548c\u6ca1\u6709\u53cd\u5c04\u53d1\u5c04\uff08\u4f8b\u5982\uff0cDynamicMethod\uff09\uff0c\u5e76\u4e14\u6240\u6709\u5185\u5bb9\u90fd\u88ab\u7f16\u8bd1\u5e76\u94fe\u63a5\u5230\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u8fd9\u610f\u5473\u7740\u4f7f\u7528\u66f4\u591a\u529f\u80fd\uff08\u6216\u53ef\u80fd\u4f7f\u7528 ) \u5e76\u4e14\u60a8\u7684\u90e8\u7f72\u53ef\u4ee5\u66f4\u5927\u3002 \u5373\u4f7f\u6709\u8fd9\u4e9b\u9650\u5236\uff0c\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u522b\u7684\u5e94\u7528\u7a0b\u5e8f\uff0cNative AOT \u4ecd\u7136\u662f .NET 7 \u4e2d\u4ee4\u4eba\u96be\u4ee5\u7f6e\u4fe1\u7684\u3001\u4ee4\u4eba\u5174\u594b\u548c\u53d7\u6b22\u8fce\u7684\u8865\u5145\u3002<\/p>\n<p>\u4eca\u5929\uff0cNative AOT \u4e13\u6ce8\u4e8e\u63a7\u5236\u53f0\u5e94\u7528\uff0c\u90a3\u4e48\u6211\u4eec\u6765\u521b\u5efa\u4e00\u4e2a\u63a7\u5236\u53f0\u5e94\u7528\uff1a<\/p>\n<pre class=\"prettyprint\">dotnet new console -o nativeaotexample<\/pre>\n<p>\u60a8\u73b0\u5728\u6709\u4e00\u4e2a\u201cHello World\u201d\u63a7\u5236\u53f0\u5e94\u7528\u7a0b\u5e8f\u3002 \u8981\u542f\u7528\u4f7f\u7528Native AOT\u53d1\u5e03\u5e94\u7528\u7a0b\u5e8f\uff0c\u8bf7\u7f16\u8f91 .csproj \u4ee5\u5728\u73b0\u6709 &lt;PropertyGroup&gt; \u4e2d\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"prettyprint\">&lt;PublishAot&gt;true&lt;\/PublishAot&gt;<\/pre>\n<p>\u8be5\u5e94\u7528\u7a0b\u5e8f\u73b0\u5728\u5df2\u5b8c\u5168\u914d\u7f6e\u4e3a\u80fd\u591f\u4ee5Native AOT\u4e3a\u76ee\u6807\u3002 \u5269\u4e0b\u7684\u5c31\u662f\u53d1\u5e03\u4e86\u3002 \u5982\u679c\u8981\u53d1\u5e03\u5230 Windows x64 \u8fd0\u884c\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre class=\"prettyprint\">dotnet publish -r win-x64 -c Release<\/pre>\n<p>\u4f1a\u5728\u8f93\u51fa\u53d1\u5e03\u76ee\u5f55\u4e2d\u751f\u6210\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n<pre class=\"prettyprint\">Directory: C:\\nativeaotexample\\bin\\Release\\net7.0\\win-x64\\publish\r\n\r\nMode                 LastWriteTime         Length Name\r\n----                 -------------         ------ ----\r\n-a---           8\/27\/2022  6:18 PM        3648512 nativeaotexample.exe\r\n-a---           8\/27\/2022  6:18 PM       14290944 nativeaotexample.pdb<\/pre>\n<p>\u5927\u7ea6 3.5MB \u7684 .exe \u662f\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5b83\u65c1\u8fb9\u7684 .pdb \u662f\u8c03\u8bd5\u4fe1\u606f\uff0c\u90e8\u7f72\u5e94\u7528\u7a0b\u5e8f\u4e0d\u9700\u8981\u8fd9\u4e9b\u4fe1\u606f\u3002 \u73b0\u5728\uff0c\u60a8\u53ef\u4ee5\u5c06\u8be5<span style=\"color: #ff0000;\"> nativeaotexample.exe<\/span> \u590d\u5236\u5230\u4efb\u4f55 64 \u4f4d Windows \u673a\u5668\u4e0a\uff0c\u5e94\u7528\u7a0b\u5e8f\u90fd\u4f1a\u8fd0\u884c\u3002<\/p>\n<p><strong>\u652f\u6301<\/strong><strong> .NET 7<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/NET-Release-Schedule.png\" \/><\/p>\n<p>.NET 7 \u7531 Microsoft \u6b63\u5f0f\u652f\u6301\u3002 \u5b83\u88ab\u6807\u8bb0\u4e3a\u6807\u51c6\u671f\u9650\u652f\u6301 (STS) \u7248\u672c\uff0c\u5c06\u83b7\u5f97 18 \u4e2a\u6708\u7684\u652f\u6301\u3002 \u5947\u6570 .NET \u7248\u672c\u662f STS \u7248\u672c\uff0c\u5728\u968f\u540e\u7684 STS \u6216 LTS \u7248\u672c\u4e4b\u540e\u7684\u516d\u4e2a\u6708\u5185\u83b7\u5f97\u514d\u8d39\u652f\u6301\u548c\u8865\u4e01\u3002 \u6709\u5173\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u6211\u4eec\u7684<a href=\"https:\/\/dotnet.microsoft.com\/platform\/support\/policy\/dotnet-core\"> .NET \u548c .NET Core \u652f\u6301\u751f\u547d\u5468\u671f<\/a>\u6587\u6863\u3002<\/p>\n<p><strong>\u53cd\u9988<\/strong><\/p>\n<p>\u901a\u8fc7<a href=\"https:\/\/github.com\/orgs\/dotnet\/repositories\">\u652f\u6301 GitHub \u4e0a\u7684\u95ee\u9898<\/a>\u3001\u5728<a href=\"https:\/\/developercommunity.visualstudio.com\/\">\u5f00\u53d1\u4eba\u5458\u793e\u533a\u4e2d\u63d0\u4f9b\u53cd\u9988<\/a>\u4ee5\u53ca\u4e0e\u793e\u533a\u4e2d\u7684\u5176\u4ed6\u4eba\u5171\u4eab\u60a8\u7684 .NET \u5e94\u7528\u7a0b\u5e8f\u548c\u9879\u76ee\uff0c\u5e2e\u52a9\u6211\u4eec\u5851\u9020 .NET 8 \u548c\u672a\u6765\u7248\u672c\u3002<\/p>\n<p>\u4f7f\u7528<a href=\"https:\/\/twitter.com\/search?q=%23dotnet7&amp;src=typed_query\">#dotnet7<\/a> \u5206\u4eab\u60a8\u7684\u60f3\u6cd5\u5e76\u968f\u65f6\u4e86\u89e3\u6709\u5173 .NET 7 \u7684\u6700\u65b0\u6d88\u606f\u3002<\/p>\n<p><strong>\u7acb\u5373\u4e0b\u8f7d<\/strong><strong> .NET 7<\/strong><\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u53ea\u60f3\u8bf4\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2022\/11\/ThankYou.png\" \/><\/p>\n<p>\u6ca1\u6709\u793e\u533a\uff0c.NET \u5c31\u65e0\u6cd5\u5b58\u5728\u3002.NET \u9879\u76ee\u662f\u4e00\u4e2a\u901a\u8fc7\u6bcf\u4e2a\u4eba\u7684\u72ec\u7279\u548c\u521b\u9020\u6027\u8d21\u732e\u7684\u9879\u76ee\u3002\u8fd9\u4e9b\u4f1f\u5927\u7684\u6210\u5c31\u548c\u6177\u6168\u6765\u81ea\u4e8e\u6211\u4eec\u793e\u533a\u6bcf\u4e2a\u4eba\u7684\u652f\u6301\u548c\u5173\u6000\u3002\u611f\u8c22\u60a8\u7684\u53c2\u4e0e\u3001\u5206\u4eab\u4ee5\u53ca\u60a8\u5bf9 .NET \u793e\u533a\u7684\u5f52\u5c5e\u3002<\/p>\n<p>.NET 7 \u662f\u4e00\u4e2a\u4e3b\u8981\u7248\u672c\uff0c\u5b83\u901a\u8fc7\u6539\u8fdb\u6027\u80fd\u3001\u529f\u80fd\u548c\u53ef\u7528\u6027\u7b49\u57fa\u7840\u77e5\u8bc6\u6765\u63d0\u9ad8\u5f00\u53d1\u4eba\u5458\u7684\u751f\u6d3b\u8d28\u91cf\u3002\u6211\u4eec\u5e0c\u671b\u8fd9\u4e9b\u65b0\u529f\u80fd\u548c\u65b0\u589e\u529f\u80fd\u7ee7\u7eed\u8ba9\u60a8\u5bf9 .NET \u5e73\u53f0\u7684\u4f7f\u7528\u611f\u5230\u6ee1\u610f\u3002<\/p>\n<p>\u4f60\u8fd8\u5728\u7b49\u4ec0\u4e48\uff1f\u5b83\u51c6\u5907\u597d\u4e86\u3002\u8bf7<a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/7.0\">\u4e0b\u8f7d .NET 7<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u7ffb\u8bd1\u4e8eJeremy Likness, Angelos Petropoulos \u548c Jon Douglas\u7684\u8fd9\u7bc7\u82f1\u6587\u6587\u7ae0\uff1a.NET 7 is Available Today \u3002 \u6b22\u8fce\u4e0b\u8f7d .NET 7\uff01 .NET 7 \u4e3aC# 11 \/ F# 7\u3001.NET MAUI\u3001ASP.NET Core\/Blazor\u3001Web API\u3001WinForms\u3001WPF\u7b49\u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u4e86\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u65b0\u529f\u80fd\u3002\u4f7f\u7528 .NET 7\uff0c\u60a8\u8fd8\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06 .NET 7 \u9879\u76ee\u5bb9\u5668\u5316\uff0c\u5728 GitHub \u64cd\u4f5c\u4e2d\u8bbe\u7f6e CI\/CD \u5de5\u4f5c\u6d41\uff0c\u5e76\u5b9e\u73b0cloud-native\u53ef\u89c2\u5bdf\u6027\u3002 \u611f\u8c22 .NET \u5f00\u6e90\u793e\u533a\u4e3a\u5851\u9020\u6b64 .NET 7 \u7248\u672c\u505a\u51fa\u7684\u4f17\u591a\u8d21\u732e\u3002\u5728\u6574\u4e2a .NET 7 \u7248\u672c\u4e2d\uff0c\u8d85\u8fc7 8900 \u540d\u8d21\u732e\u8005\u505a\u51fa\u4e86 28k \u8d21\u732e\uff01 .NET \u4ecd\u7136\u662f\u6700\u5feb\u3001\u6700\u53d7\u559c\u7231\u548c\u6700\u53d7\u4fe1\u4efb\u7684\u5e73\u53f0\u4e4b\u4e00\uff0c\u5b83\u62e5\u6709\u4e00\u4e2a\u5e7f\u6cdb\u7684.NET \u5305\u751f\u6001\u7cfb\u7edf\uff0c\u5176\u4e2d\u5305\u62ec\u8d85\u8fc7 330,000 \u4e2a\u5305\u3002 \u4e0b\u8f7d\u548c\u5347\u7ea7 \u60a8\u53ef\u4ee5\u4e0b\u8f7d\u9002\u7528\u4e8e Windows\u3001macOS [&hellip;]<\/p>\n","protected":false},"author":99475,"featured_media":165,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet-ch","tag-net"],"acf":[],"blog_post_summary":"<p>\u672c\u6587\u7ffb\u8bd1\u4e8eJeremy Likness, Angelos Petropoulos \u548c Jon Douglas\u7684\u8fd9\u7bc7\u82f1\u6587\u6587\u7ae0\uff1a.NET 7 is Available Today \u3002 \u6b22\u8fce\u4e0b\u8f7d .NET 7\uff01 .NET 7 \u4e3aC# 11 \/ F# 7\u3001.NET MAUI\u3001ASP.NET Core\/Blazor\u3001Web API\u3001WinForms\u3001WPF\u7b49\u5e94\u7528\u7a0b\u5e8f\u5e26\u6765\u4e86\u66f4\u9ad8\u7684\u6027\u80fd\u548c\u65b0\u529f\u80fd\u3002\u4f7f\u7528 .NET 7\uff0c\u60a8\u8fd8\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06 .NET 7 \u9879\u76ee\u5bb9\u5668\u5316\uff0c\u5728 GitHub \u64cd\u4f5c\u4e2d\u8bbe\u7f6e CI\/CD \u5de5\u4f5c\u6d41\uff0c\u5e76\u5b9e\u73b0cloud-native\u53ef\u89c2\u5bdf\u6027\u3002 \u611f\u8c22 .NET \u5f00\u6e90\u793e\u533a\u4e3a\u5851\u9020\u6b64 .NET 7 \u7248\u672c\u505a\u51fa\u7684\u4f17\u591a\u8d21\u732e\u3002\u5728\u6574\u4e2a .NET 7 \u7248\u672c\u4e2d\uff0c\u8d85\u8fc7 8900 \u540d\u8d21\u732e\u8005\u505a\u51fa\u4e86 28k \u8d21\u732e\uff01 .NET \u4ecd\u7136\u662f\u6700\u5feb\u3001\u6700\u53d7\u559c\u7231\u548c\u6700\u53d7\u4fe1\u4efb\u7684\u5e73\u53f0\u4e4b\u4e00\uff0c\u5b83\u62e5\u6709\u4e00\u4e2a\u5e7f\u6cdb\u7684.NET \u5305\u751f\u6001\u7cfb\u7edf\uff0c\u5176\u4e2d\u5305\u62ec\u8d85\u8fc7 330,000 \u4e2a\u5305\u3002 \u4e0b\u8f7d\u548c\u5347\u7ea7 \u60a8\u53ef\u4ee5\u4e0b\u8f7d\u9002\u7528\u4e8e Windows\u3001macOS [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/users\/99475"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media\/165"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet-ch\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}