{"id":20686,"date":"2018-12-13T16:13:41","date_gmt":"2018-12-14T00:13:41","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/dotnet\/?p=20645"},"modified":"2019-02-19T19:55:51","modified_gmt":"2019-02-20T02:55:51","slug":"visual-studio-2019-net-productivity","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/visual-studio-2019-net-productivity\/","title":{"rendered":"Visual Studio 2019 Preview .NET Productivity"},"content":{"rendered":"<p>As you hopefully heard, the first preview of <a href=\"https:\/\/visualstudio.microsoft.com\/vs\/preview\/\">Visual Studio 2019<\/a> is now available. In this post I\u2019ll cover some of the productivity improvements for .NET developers we\u2019re most excited about. For a complete list, check out the <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/releases\/2019\/release-notes-preview#dotnettools\">release notes<\/a>.<\/p>\n<h3>Regex Language Support<\/h3>\n<p>Any <span><a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/api\/system.text.regularexpressions.regex\">regular expressions<\/a><\/span> in your C# or Visual Basic files now have syntax highlighting, compiler diagnostics, and code fixes! This parsing support can <span>recognize strings passed to the regex constructor<\/span><span>\u00a0<\/span>and <span>strings immediately preceded with a comment containing the string `language=regex`<\/span><span>. The <\/span><span>language features currently included in this release are<\/span> c<span>lassification<\/span><span>, <\/span><span>brace matching<\/span><span>, <\/span><span>highlight references<\/span><span>, and compiler diagnostics<\/span>.<\/p>\n<p><div style=\"width: 1194px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-20686-1\" width=\"1194\" height=\"442\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-Regex.mp4?_=1\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-Regex.mp4\">https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-Regex.mp4<\/a><\/video><\/div><\/p>\n<h3>Export editor settings to Editorconfig<\/h3>\n<p>You can now export editor settings to an <span><a href=\"https:\/\/na01.safelinks.protection.outlook.com\/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fvisualstudio%2Fide%2Fcode-styles-and-quick-actions%23editorconfig-files&amp;data=02%7C01%7Ckehavens%40microsoft.com%7Cb925bc8a3a6f47184d8d08d654d421b0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636789667427101714&amp;sdata=zMl%2B32JOPwQCIS18h4QIPvM%2B%2BOwGiN9MSrLGdNcN8e0%3D&amp;reserved=0\">Editorconfig<\/a><\/span> file through <strong>Tools &gt; Options &gt; Text Editor &gt; C# &gt; Code Style<\/strong> with the button \u201cGenerate .editorconfig file from settings\u201d.<\/p>\n<p><figure id=\"attachment_20655\" aria-labelledby=\"figcaption_attachment_20655\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-GenerateEditorconfig.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-GenerateEditorconfig-1024x561.png\" alt=\"\" width=\"879\" height=\"482\" class=\"size-large wp-image-20655\" \/><\/a><figcaption id=\"figcaption_attachment_20655\" class=\"wp-caption-text\">Generate your code style settings to a .editorconfig file.<\/figcaption><\/figure><\/p>\n<h3>Code Fixes and Refactorings<\/h3>\n<p>We added several of the top-requested code fixes and refactorings in Visual Studio 2019 Preview 1. Many were implemented by the community so hats off to our awesome contributors! Refactorings and quick actions are available using (Ctrl + .) or (Alt + Enter).<\/p>\n<p><strong>Foreach loop to LINQ query<\/strong><\/p>\n<p>Foreach loops to LINQ queries or LINQ methods now join the other loop refactoring options including converting LINQ to Foreach, For loop to Foreach, and Foreach to For loop.<\/p>\n<p><div style=\"width: 1168px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-20686-2\" width=\"1168\" height=\"846\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-ToLinqQuery.mp4?_=2\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-ToLinqQuery.mp4\">https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-ToLinqQuery.mp4<\/a><\/video><\/div><\/p>\n<p><strong>Add &#8220;Using&#8221; Statement on copy\/paste<\/strong><\/p>\n<p><div style=\"width: 822px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-20686-3\" width=\"822\" height=\"576\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-AddMissingUsings.mp4?_=3\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-AddMissingUsings.mp4\">https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-AddMissingUsings.mp4<\/a><\/video><\/div><\/p>\n<p><strong>Convert anonymous type to class<\/strong><\/p>\n<p><div style=\"width: 1232px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-20686-4\" width=\"1232\" height=\"1076\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-AnonToClass.mp4?_=4\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-AnonToClass.mp4\">https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-AnonToClass.mp4<\/a><\/video><\/div><\/p>\n<p><strong>Convert local function to method<\/strong><\/p>\n<p><div style=\"width: 1418px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-20686-5\" width=\"1418\" height=\"650\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-LocalFuncToMethod.mp4?_=5\" \/><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-LocalFuncToMethod.mp4\">https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/2019Blog-LocalFuncToMethod.mp4<\/a><\/video><\/div><\/p>\n<h3><\/h3>\n<p>More new code fixes and refactorings:<\/p>\n<ul>\n<li>Convert tuple to a named-struct.<\/li>\n<li>Dead code analysis for unused private members with an optional code fix to remove unused member declaration.<\/li>\n<li>Generate a deconstruct method.<\/li>\n<li>Add \u201cawait\u201d where it is implied, but there is no compiler warning.<\/li>\n<\/ul>\n<p>View all the code fixes and refactorings for .NET in our <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/quick-actions\">docs<\/a>.<\/p>\n<h3>Document health indicator<\/h3>\n<p>The document health indicator allows you to look in one place to know if code style errors or warnings are present in the file you have open and makes it easy to jump to them. The indicator appears in the bottom right corner of your code editor making it easy to access <a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/code-styles-and-quick-actions\">code style configurations<\/a> and run code cleanup.<\/p>\n<p><figure id=\"attachment_20745\" aria-labelledby=\"figcaption_attachment_20745\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-DocHealthInd.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-DocHealthInd.png\" alt=\"\" width=\"301\" height=\"120\" class=\"size-full wp-image-20745\" \/><\/a><figcaption id=\"figcaption_attachment_20745\" class=\"wp-caption-text\">Document Health Indicator<\/figcaption><\/figure><\/p>\n<h3>Find All References and CodeLens Razor support<\/h3>\n<p>Find All Reference (Shift-F12) and CodeLens now show results from <a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/web-pages\/overview\/getting-started\/introducing-razor-syntax-c\">Razor<\/a> (.cshtml) files in .NET Core projects. You can then navigate to the identified code in the relevant Razor files.<\/p>\n<p><figure id=\"attachment_20695\" aria-labelledby=\"figcaption_attachment_20695\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-RazorCodeLens.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-RazorCodeLens.png\" alt=\"\" width=\"776\" height=\"163\" class=\"size-full wp-image-20695\" \/><\/a><figcaption id=\"figcaption_attachment_20695\" class=\"wp-caption-text\">CodeLens now shows Razor (.cshtml) results.<\/figcaption><\/figure><\/p>\n<p><figure id=\"attachment_20705\" aria-labelledby=\"figcaption_attachment_20705\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-RazorFAR.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-RazorFAR.png\" alt=\"\" width=\"777\" height=\"189\" class=\"size-full wp-image-20705\" \/><\/a><figcaption id=\"figcaption_attachment_20705\" class=\"wp-caption-text\">Razor results in Find All References.<\/figcaption><\/figure><\/p>\n<h3>Run tests from Solution Explorer<\/h3>\n<p>You can now right-click on tests, test classes, or test projects in the Solution Explorer to run or debug tests.<\/p>\n<p><figure id=\"attachment_20685\" aria-labelledby=\"figcaption_attachment_20685\" class=\"wp-caption aligncenter\" ><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-RunTestSlnExplorer.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/10\/2019\/02\/Blog2019-RunTestSlnExplorer.png\" alt=\"\" width=\"578\" height=\"586\" class=\"size-full wp-image-20685\" \/><\/a><figcaption id=\"figcaption_attachment_20685\" class=\"wp-caption-text\">Right-click to run tests from the Solution Explorer.<\/figcaption><\/figure><\/p>\n<p>As always, thank you for trying out previews, giving feedback on Developer Community, and using the\u00a0<a href=\"https:\/\/docs.microsoft.com\/en-us\/visualstudio\/ide\/how-to-report-a-problem-with-visual-studio-2017?view=vs-2017\">Report a Problem<\/a>\u00a0tool in Visual Studio. Read more or watch a video on other Visual Studio 2019 Preview 1 features in the <a href=\"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2018\/12\/04\/making-every-developer-more-productive-with-visual-studio-2019\/\">blog post<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you hopefully heard, the first preview of Visual Studio 2019 is now available. In this post I\u2019ll cover some of the productivity improvements for .NET developers we\u2019re most excited about. For a complete list, check out the release notes. Regex Language Support Any regular expressions in your C# or Visual Basic files now have [&hellip;]<\/p>\n","protected":false},"author":355,"featured_media":21642,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685],"tags":[4,311,312,313,314,315,316,317,318,147,149],"class_list":["post-20686","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","tag-net","tag-code-fixes","tag-dotnet-format","tag-editorconfig","tag-navigation","tag-quick-actions","tag-refactoring","tag-regex","tag-tests","tag-visual-studio","tag-visual-studio-preview"],"acf":[],"blog_post_summary":"<p>As you hopefully heard, the first preview of Visual Studio 2019 is now available. In this post I\u2019ll cover some of the productivity improvements for .NET developers we\u2019re most excited about. For a complete list, check out the release notes. Regex Language Support Any regular expressions in your C# or Visual Basic files now have [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/20686","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/355"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=20686"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/20686\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/21642"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=20686"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=20686"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=20686"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}